This is part of a series on hosting a website on the Raspberry Pi. Click the Raspberry Pi Webserver in the Blog Series to the right for the complete steps.

To configure and view our WordPress website, you will need to configure Apache. Remember to change example.com to your domain name.

sudo cd /etc/apache2/sites-available
sudo cp 000-default.conf example.com.conf
sudo nano example.com.conf

Change the default information from this:

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

To this, adding the two top lines and changing the last:

ServerName www.example.com
ServerAlias example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/example.com

That’s it, now you just need to enable the website, reload Apache, and test your domain name.

sudo a2ensite example.com
sudo systemctl reload apache2

Next, test you domain in the browser and you should be redirected to the WordPress configuration page.

That is all we need to do with Apache at this moment, now let’s move on to the next post: Configure WordPress.

Share this content: