Steps to Configure Apache for WordPress
I develop WordPress locally using vagrant and chef to setup a VM** with a LAMP stack. Once I have the VM up and running I usually need to make a few changes to apache to get my wordpress site going. Here are some notes on going through that process, and the resources I used.
First Follow This:
The first half of the article walks through the LAMP setup. If you already have your apache / php / mysql packages installed, jump right down to “Configure” to walk through configuring Apache.
Some basic Apache commands
Login as Root
Once you are logged in as vagrant you can # sudo su – to become root without password.
Enable / Disable Site, Enable / Disable Apache Module
# enable site
sudo a2ensite
# disable site
sudo a2dissite
# enable an apache2 module
sudo a2enmod
# e.g. a2enmod php4 will create the correct symlinks in mods-enabled to allow the module to be used. In this example it will link both php4.conf and php4.load for the user
# disable an apache2 module
sudo a2dismod
Force reload server
# force reload the server:
sudo /etc/init.d/apache2 force-reload
Restart Apache
sudo /etc/init.d/apache2 restart
Common errors and solutions
Error: NameVirtualHost *:443 has no VirtualHosts
This is fine – port 443 is for SSL, not really necessary for a local wordpress environment
apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
To fix that problem, you need to edit the httpd.conf file. Open the terminal and type,
sudo vi /etc/apache2/httpd.conf
** I used to use MAMP, which means you don’t actually have to do any of this. MAMP will change the paths to MySQL on your machine. I found it interfered with some other projects I was running, so now I prefer to keep each project in its own isolated environment.
