Create Virtual Host that can be access locally for wordpress development.

Create Directory

sudo mkdir /var/www/wordpress.local

Create test html file

sudo nano /var/www/wordpress.local/index.html

Add code to test fie


Apache comes with a default virtaul host file call 000-default.conf. We will use that as a template.

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/wordpress.local.conf

Open virtual host file

sudo nano /etc/apache2/sites-available/wordpress.local.conf

Make change so file looks like this

<VirtualHost *:80>
 ServerAdmin webmaster@localhost
 DocumentRoot /var/www/wordpress.local
 ServerName wordpress.local
 ServerAlias www.wordpress.local
 ErrorLog ${APACHE_LOG_DIR}/error.log
 CustomLog ${APACHE_LOG_DIR}/access.log combined

Enable virtual host with a2ensite tool

sudo a2ensite wordpress.local.conf

Restart Apache

sudo service apache2 reload

One more step in order to make host accessable locally. Edit “/etc/hosts”
and add the following line wordpress.local