Sunday, November 3, 2013

Apache errors after upgrade from 2.2 to 2.4, or upgrading ubuntu 13.04 to ubuntu 13.10

Today I upgraded my laptop ubuntu from raring ringtail to saucy salamander. After setting the desktop to the salamander wallpaper, I moved to my http://localhost, but alas! the apache configuration was not working. I was getting the default "It works" page from /var/www/index.html . During the upload process, I was asked whether I want to update the configurations in /etc/apache2/envvars and /etc/php5/apache2/php.ini. I had selected to upgrade both of them while noting down the previous customizations that will be lost. So, I set out to correct this new after upgrade error :

1. Bring back the customization removed during the upgrade process. I usually run the apache2 process by the normal user instead of www-data. Edited the /etc/apache2/envvars file to bring back old users.
Then changed the error reporting on php.ini files. Apache restart with sudo service apache2 restart. Check http://localhost/ , still getting  the default "It works" page. Moving on..

2. The vhosts not working :
The first obvious error was that none of the virtual hosts were working. After looking through the apache.conf file in /etc/apache2 I found the line :
Include sites-enabled/*.conf
This made it mandatory for virtual hosts files to have *.conf ending to be read as legit files. To correct this error, it is better to delete all links in sites-enabled/ folder. Then append .conf to the vhosts file inside sites-available/. Then enable each site one by one. Apache reload with sudo service apache2 reload Check http://localhost/ . New error : 403 permission denied. But I corrected the run user to the file owner, let's check the logs

3. The authz issue :
Going through the logs, error coming up was
[Sun Nov 03 18:02:27.790498 2013] [authz_core:error] [pid 5530] [client 127.0.0.1:50046] AH01630: client denied by server configuration: /home/vibhav/public_html/
So apparently, the line "allow from all" in vhosts was not working as it was working before. I went to the upgrading document of apache and found that some things have changed her. Instead of
order allow, deny
allow from all
The new configuration needed
Require all granted
 Do a sudo service apache2 reload again and head to http://localhost/ . It's all working.

This worked for me. If this is not all, please check out http://httpd.apache.org/docs/2.4/upgrading.html for the official upgrade documentation. If you are still having problems, please mention it in comments below.

No comments:

Post a Comment