Apache migration

From wiki.techunit.org
Jump to: navigation, search


During the migration to Jessie, we needed to migrate a lot of servers. For a lot of services, migration work through without pain. But for the Apache migration, changes from apache config files cause error to start service. On this post, I will try to join some error I had to fix.

Config file extensions

In Apache older version, virtualhosts did not need any extension to operate. While in recent version, Apache2 does not read any config file without ".conf" extension. That's why, during migration it can cause you some trouble.


First check your /etc/apache2/sites-{availables,enabled}

#Backup apache directory
cp -r /etc/apache2/ /etc/apache2.orig
#remove all symlinks
rm /etc/apache2/sites-enabled/*
#Rename all config files
cd /etc/apache2/sites-available
for f in $(ls|grep -v .conf) ; do mv $f $f.conf ; done
#Enable your sites
for f in $(ls|grep -v default) ; do a2ensite $f ; done
service apache2 restart

Config files

Older additional config file in Apache was /etc/apache2/conf.d/, then in newer version, directory is in /etc/apache2/conf-{available,enabled}/ (like virtualhost). So if you have some trouble with your apache or websites, it's a good lead to investigate.

mv /etc/apache2/conf.d/configexample /etc/apache2/conf-available/configexample.conf
a2enconf configexample
apache2ctl graceful

techUnit's cofounder