Wordpress Apache Config Errors - wordpress

I have installed Wordpress on Apache. It appears to work fine, i get the homepage and have created pages on the admin.
I can access the home[page fine. But when i try access the pages. I get 404s.
http://mysite.com/ works fine
http://mysite.com/news throughs a 404.
In the log files, I have the following error:
[Fri Dec 14 10:21:58 2012] [error] [client 127.0.0.1] File does not exist: /home/wordpress/mysite/news, referer: http://mysite.com/
I am using NameBasedVirtual hosting in Apache.
<VirtualHost *:8080>
ServerName mysite.com
DocumentRoot /home/wordpress/mysite/
ErrorLog /var/log/www/mysite-error.log
CustomLog /var/log/www/mysite-access.log combined
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
<Directory /home/wordpress/mysite>
AllowOverride FileInfo Options
Allow from all
DirectoryIndex index.php
</Directory>
<Location /wp-admin/>
Header set Cache-Control no-cache
</Location>
</VirtualHost>

I looked at .htaccess.
It says .
But Apache doesnt have mod_rewrite installed by default on Ubuntu. So it didnt work and didnt through a nice error.
Just add in mod_rewrite to fix this

Related

Why am I suddenly recieving Access Forbidden Error 403 when trying to access localhost/phpmyadmin?

I use xampp to develope my Wordpress sites, 3 months ago I set up a project and accessed localhost/phpmyadmin with no issues and have been working on the project since. However yesterday I tried to set up a new project and access localhost/phpmyadmin and I recieved:
403 Error page: "Access forbidden! You don't have permission to access the requested object. It is either read-protected or not readable by the server. If you think this is a server error, please contact the webmaster."
I haven't updated xampp or changed anything since 3 months ago and my other wordpress project is working perfectly, no database issues.
I just can't access localhost/phpmyadmin.
I'm using Apache/2.4.37 (Win32), PHP/7.3.0, OpenSSL/1.1.1a, XAMPP Control Panel v3.2.2
I've tried editing C:/xampp/apache/conf/extra/httpd-xampp.conf and replacing "require local" with both "request all garunteed" and "require all granted" inside but neither worked.
I've read lots of other threads but everyone's httpd-xampp.conf file contains a LocationMatch tag, which mine does not.
Here is my httpd-xampp.conf file:
#
# XAMPP settings
#
<IfModule env_module>
SetEnv MIBDIRS "C:/xampp/php/extras/mibs"
SetEnv MYSQL_HOME "\\xampp\\mysql\\bin"
SetEnv OPENSSL_CONF "C:/xampp/apache/bin/openssl.cnf"
SetEnv PHP_PEAR_SYSCONF_DIR "\\xampp\\php"
SetEnv PHPRC "\\xampp\\php"
SetEnv TMP "\\xampp\\tmp"
</IfModule>
#
# PHP-Module setup
#
LoadFile "C:/xampp/php/php7ts.dll"
LoadFile "C:/xampp/php/libpq.dll"
LoadModule php7_module "C:/xampp/php/php7apache2_4.dll"
<FilesMatch "\.php$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
#
# PHP-CGI setup
#
#<FilesMatch "\.php$">
# SetHandler application/x-httpd-php-cgi
#</FilesMatch>
#<IfModule actions_module>
# Action application/x-httpd-php-cgi "/php-cgi/php-cgi.exe"
#</IfModule>
<IfModule php7_module>
PHPINIDir "C:/xampp/php"
</IfModule>
<IfModule mime_module>
AddType text/html .php .phps
</IfModule>
ScriptAlias /php-cgi/ "C:/xampp/php/"
<Directory "C:/xampp/php">
AllowOverride None
Options None
Require all denied
<Files "php-cgi.exe">
Require all granted
</Files>
</Directory>
<Directory "C:/xampp/cgi-bin">
<FilesMatch "\.php$">
SetHandler cgi-script
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler None
</FilesMatch>
</Directory>
<Directory "C:/xampp/htdocs/xampp">
<IfModule php7_module>
<Files "status.php">
php_admin_flag safe_mode off
</Files>
</IfModule>
AllowOverride AuthConfig
</Directory>
<IfModule alias_module>
Alias /licenses "C:/xampp/licenses/"
<Directory "C:/xampp/licenses">
Options +Indexes
<IfModule autoindex_color_module>
DirectoryIndexTextColor "#000000"
DirectoryIndexBGColor "#f8e8a0"
DirectoryIndexLinkColor "#bb3902"
DirectoryIndexVLinkColor "#bb3902"
DirectoryIndexALinkColor "#bb3902"
</IfModule>
Require local
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>
Alias /phpmyadmin "C:/xampp/phpMyAdmin/"
<Directory "C:/xampp/phpMyAdmin">
AllowOverride AuthConfig
Require local
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>
Alias /webalizer "C:/xampp/webalizer/"
<Directory "C:/xampp/webalizer">
<IfModule php7_module>
<Files "webalizer.php">
php_admin_flag safe_mode off
</Files>
</IfModule>
AllowOverride AuthConfig
Require local
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>
</IfModule>
You might try checking permissions on "C:/xampp/phpMyAdmin/". Maybe you accidentally changed them / owner.
Good luck.
I found the solution and it had nothing to do with my configurations. For some reason my phpmyadmin folder had been moved out of C:/xampp into C:/Data.
No idea how, possibly Windows update?
Anyway, I found this by going to the XAMPP Control Panel > Apache > Config > phpMyAdmin and when I clicked on it; it said it could not find the file in C:/xampp/phpmyadmin.
I then searched my computer for phpmyadmin and found it in C:/Data. Cut and pasted it into C:/xampp and voila! Everything works perfectly.
image of xampp control panel showing steps

wordpress site working locally but not from the domain

My wordpress site is working locally in my wamp server, this is hosted on an ec2 instance and domain is maintained in Route 53\cloudfare. The domain is working when i checked it using mxtoolbox. The site was working and live till the time i changed my host file in the server. I removed the host file entries accidentally thinking it is a dev site, however i restored it but still the site is not working and i am getting only the "TOO MANY REDIRECTS" error. The following is the current windows host file details
#
127.0.0.1 localhost
::1 localhost
127.0.0.1 mydomain.com
::1 mydomain.com
I restarted the server and WAMP multiple times but it is not working.
The following is my virtualhost configuration
# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride all
Require all granted
</Directory>
</VirtualHost>
#
<VirtualHost *:80>
ServerName mydomain.com
DocumentRoot "c:/wamp/www/sitefolder"
<Directory "c:/wamp/www/sitefolder/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride all
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName www.mydomain.com
DocumentRoot "c:/wamp/www/sitefolder"
<Directory "c:/wamp/www/sitefolder/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride all
Require all granted
</Directory>
</VirtualHost>`
Clean your cache and browser history first, then try doing it below:
Open your wordpress admin panel --> Settings--> General --> Make sure it points to the correct domain. --> Save
Or go to the wp-config.php file (Try this if the first method fails / can't be accessed)
add:
define('WP_HOME','http://YourDomain.com');
define('WP_SITEURL','http://YourDomain.com');
or
Try to remove or rename default .htaccess
or
Try to disable the plugin (renaming the plugin folder in the "wp-content/plugin/plugin-folder-name" will non-active that plugin. This might solve the problem if the constraints are due to the plugin)
That's a number of ways when I resolve the ERR_TOO_MANY_REDIRECTS problem. Goodluck

VirtualHost apache always returns same website not subdomain

I'm using apache 2.2.15, in a virtual machine over CentOS 6, I have a symfony proyect working here and my boss want to load a wordpress website in the same server on a subdomain.
Subdomain is not working, I've tried a lot of configurations, this is the last one used:
mysite.cl.conf (in /etc/httpd/conf.d folder)
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/html/symfonyProyect/web
ServerName mysite.cl
ServerAlias mysite.cl
ErrorLog /var/log/httpd/symfonyProyect_error.log
CustomLog /var/log/httpd/symfonyProyect_access.log combined
<Location />
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /app.php [L]
</IfModule>
DirectoryIndex app.php
</Location>
</VirtualHost>
<VirtualHost *:80>
ServerName mysubdomain.mysite.cl
DocumentRoot /var/www/html/mysubdomain
<Directory /var/www/html/mysubdomain>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/httpd/mysubdomain_error.log
CustomLog /var/log/httpd/mysubdomain_access.log combined
</VirtualHost>
my hosts file (in /etc folder)
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
myip mysite.cl mysubdomain.mysite.cl
and my hosts.conf
multi on
when I try mysite.cl it shows the symfony website, but when I try mysubdomain.mysite.cl, it gives me the "This site can't be reached" or "ERR_NAME_NOT_RESOLVED".
The if I delete the first VirtualHost block, it showsme the wordpress website ( even using ServerName mysubdomain.mysite.cl).
Am I missing some configuration or something??
The error you are getting is a DNS one not one from Apache. You need to modify the hosts file on same machine you are trying to browse to mysubdomain.mysite.cl.
Open a command prompt/shell on the machine you are running your browser on and just run ping mysubdomain.mysite.cl if it works your browsing should work too. If you get a message something like ping: unknown host mysubdomain.mysite.cl (Linux) or Ping request could not find host mysubdomain.mysite.cl (Windows). then simply edit the hosts file on that system or get a DNS entry added to your name server.
Simply editing /etc/hosts on the server that Apache runs on doesn't cause all other hosts to be able to resolve a hostname to an IP address.

mono fails to serve css files [error] command failed: failed to send file (file data)

I'm running mvc2 project on ubuntu 12.04.2 with mono 2.10.8.1 (Debian 2.10.8.1-1ubuntu2.2) - i installed apache mod_mono_server4 ...
Mono is no more serving css or script files, in the apache log the entry is: [error] command failed: failed to send file (file data) every time it serve a page.
I'm sure it has read/write permission into that folder - it serves correctly all pages but without css. Trying to access ccs directly apache says "The server encountered an internal error or misconfiguration and was unable to complete your request."
Any help on what i'm missing will be really welcome
Mi virtualHost file is:
<VirtualHost *:80>
ServerName alibi.sr
ServerAdmin web-admin#alibi.sr
DocumentRoot /var/www/nopunti/alibi/alibi_WebUI
MonoServerPath alibi.sr "/usr/bin/mod-mono-server4"
MonoDebug alibi.sr true
MonoSetEnv alibi.sr MONO_IOMAP=all
MonoApplications alibi.sr "/:/var/www/nopunti/alibi/alibi_WebUi"
<Location "/">
Allow from all
Order allow,deny
MonoSetServerAlias alibi.sr
SetHandler mono
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip dont-vary
</Location>
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css
</IfModule>
</VirtualHost>
Finally i just copied all files into another directory, modified the virtual host, restarted apache and it started working again.

I need to be able to a) use virtual hosts in my home folder on Linux, and b) use symlinks

So I have Ubuntu 12.04 (Desktop) and want to setup a virtual host for a.localhost. I know how to setup the sites-enabled and /etc/hosts. What I haven't been able to figure out is how to direct the virtual hosts to /home/aubrey/a.project and link /home/aubrey/a.project/b to /home/aubrey/Project A/b and be able to access it all using http://a.localhost/b
Another Explanation:
Ironically, I did this just fine on Windowz and xampp. I just want to be able to keep plugin code in repositories in my home folder and a WordPress install in something like /home/aubrey/a-wordpress and have /home/plugin-project/plugin-a linked to /home/aubrey/a-wordpress/wp-content/plugins/plugin-a.
Does this problem apply to all files within the plugins directory? Specifically static files like CSS or JS? Or does this problem only occur with PHP files?
If it's only the PHP files, check your PHP configuration. Maybe you have an open_basedir configured there?
If I'm not mistaken, you want +SymLinksIfOwnerMatch, not -SymLinksIfOwnerMatch. The - says to disallow the directive as opposed to the + which turns the directive on. But it's definitely possible that something else is going to cause problems here.
Okay, this is what I did to get things working:
First, enabled userdir
sudo a2enmod userdir
Then, edited /etc/apache2/mods-enabled/php5.conf
<IfModule mod_php5.c>
<FilesMatch "\.ph(p3?|tml)$">
SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
</FilesMatch>
# To re-enable php in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
<IfModule mod_userdir.c>
<Directory /home/*/public_html>
#php_admin_value engine Off
</Directory>
</IfModule>
</IfModule>
Notice I commented out the php_admin_value to allow PHP.
Then, created a virtual host:
<VirtualHost *:80>
ServerName philknight.localhost
DocumentRoot /home/aubrey/public_html/philknight-wordpress
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /home/aubrey/public_html/philknight-wordpress>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
And, in /home/aubrey/public_html/philknight-wordpress was able to create a link to wp-content elsewhere in my home folder, /home/aubrey/Documents/Projects & Companies/Excion/Metz Tennis/PhilKnight/wp-content/themes/philknight to be exact actually. I used the common SHIFT_CTRL drag method, but I'm sure ln -s would work too.
Hope this helps anyone, comment if you have questions...
Permissions:
drwxrwxrwx 4 www-data www-data 4096 Aug 20 18:46 /home/aubrey/public_html
drwxrwxrwx 8 aubrey aubrey 4096 Aug 20 21:11 /home/aubrey/Documents/Projects & Companies/Excion/Metz Tennis/PhilKnight/wp-content
Also had to chmod 777 -R /home/aubrey/Documents/Projects & Companies/Excion/Metz Tennis/PhilKnight/wp-content/plugins and /home/aubrey/Documents/Projects & Companies/Excion/Metz Tennis/PhilKnight/wp-content/themes

Resources