Home » Wordpress Installation » Installing WordPress – Apache web server configuration

Installing WordPress – Apache web server configuration

In this part of the Installing WordPress series we look at the WordPress Apache web server configuration files necessary to get your WordPress site on the Internet.

WordPress Apache web server configuration

A basic wordpress apache web server configuration file is shown in the section below. In most apache installations on Linux there will be a configuration directory in /etc/apache2/ which will contain a sites-available and a sites-enabled directory. To create a virtual server configuration for apache, create a new file in the sites-available directory.

As a convention, I would tend to call the file the name of the site, so for example my-site-name.co.uk.conf.

As with the sample nginx configuration file I posted in the last article on Installing WordPress, there are other options which you may want to configure in your configuration file, particularly if you want to hide the site from the public whilst you are preparing content.

The parts of the config shown above which will definitely need to be changed are highlighted:


This, as the name suggests, points at the root of the install directory. In the example above I’ve used the directory which I used in the first part of this installing wordpress series but obviously, you need to set this to the correct directory for your instalation.


The server name directive is set to the url that you are intending the site to be available on.


The server alias directive is used to provide other urls which the site will also be available on. In this example I’ve added the www version of the site as an alias, but you need to make sure that the www version actually redirects to the non www version, or the other way round if you prefer. The important thing is to make sure the site isn’t actually visible to users on more than one URL because that will affect the site’s SEO.

ErrorLog and CustomLog

These two directives set the location and name of the error log file and the access log file. The location is probably what you want but the file name would be better set to something more appropriate for your site.

Installation Directory

The other part of the file which needs to be changes is to change the Directory directive to be correct for your installation directory.

Applying the configuration

To apply the configuration there are some commands which the apache  installation provides to make the process slightly easier than under nginx.

Assuming the file above is called my-site-name.co.uk.conf and is in the sites-available directory the command

will create a link from the file into the sites-enabled directory. Then we need to reload the apache web server to make the configuration live, but before that I tend to test that the configuration is valid by using the command

Assuming that command reports no errors in the config file, we can apply the configuration with the command

which will restart the server and apply the new configuration.

In the next part of this series we will continue the WordPress install and configure the DNS so our chosen host names / urls work.



Leave a Reply

error: Content is protected !!
%d bloggers like this: