Server Setup 4: Going Public

If this is your first time looking at a post from this series, have a look at this summary: Server Setup 0: Contents

In this post we’ll configure another site that will hold your WordPress installation (but not install WordPress yet) and make it available on the internet.

Domain name setup

While it’s technically possible to get at your site without a domain name, it’s pretty awkward.

So, go buy one – they’re cheap, and there and hundreds to choose from. Just google “domain name”. A few bits of advice:

  • While there are some very cheap deals, it’s often just for the first year. Pay attention to the renewal price, in case you want to keep the domain a long time.
  • Look for WHOIS Privacy or a similar feature. You’re required (by law) to provide your real name and contact details when you buy a domain, but WHOIS Privacy means that the information is protected and not publicly available. It might cost extra.

So now you own a little slice of the internet. For the rest of this example I’ll assume it’s You can do what you like with this, like creating websites at, or set up an email service with For this tutorial, We’ll install WordPress at

Apache Site Configuration

First up, lets create a webpage in a new folder in /var/www/

cd /var/www
sudo mkdir wordpress
cd wordpress
sudoedit index.html

We’ll put some real HTML in it this time:

        <title>My website</title>
        <h1>Hello Everyone</h1>
        <p>It's not ready yet, but check back soon for my new blog!</p>

Now we’ll create the apache site that’ll show you this page. This time the address will be

sudoedit /etc/apache2/sites-available/wordpress.conf
<VirtualHost *:80>
    DocumentRoot /var/www/wordpress

     <Directory /var/www/html/wordpress/>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted

    ErrorLog ${APACHE_LOG_DIR}/wordpress_error.log
    CustomLog ${APACHE_LOG_DIR}/wordpress_access.log combined

We’ll enable this site, disable the default site while we’re at it, and reload apache:

sudo a2ensite wordpress
sudo a2dissite 000-default
sudo systemctl reload apache2

Configure the hosts files on your client:

And load it up in the browser on your client to test!

Port Forwarding

So, what we’ve done so far:

  • Configure a server that is a website that works inside your home network.

The next step is:

  • Send traffic that arrives at your router (from the internet) to your server.

That’s called Port Forwarding. If you’re unfamiliar with the concept of ports in computer networking, I like to think of them like telephone extension numbers when you call a large company – the main phone number gets you to the reception, but if you also have the extension number, you gets straight to the right department.

Port forwarding means that when traffic arrives at your router, it looks at what the port is, then uses that to decide which device on the network to send the traffic to.

Exactly how you get your router to do this is dependant on the make and model of your router – you can look in the documentation for it – the name of this feature is usually port forwarding, but could be Permit Access, Port Sharing, or something related. The website is a great resouces for rotuer-specific information on how to do this.

Your router might have built in profiles for hosting a website: they’ll usually be called something like (the names in brackets are the secure versions of the same thing).

  • Website (Secure Website)
  • HTTP Server (HTTPS Server)

If not, you need to forward traffic arriving on ports 80 to your server (either by IP or hostname), also on ports 80. Do the same exact thing with port 443 as well.

DNS configuration

The final step is to make it so that when someone types in your domain name (e.g. the traffic gets to your router.

How this depends on your ISP. I’m going to assume they aren’t blocking you from hosting a website. You’ll either have a fixed IP address (great!) or dynamic IP address (not so great, but still workable).

This is the public IP of your router, not your local network IP address that we’ve been working with so far. This is what appears when you Google What’s my IP Address.

Ask your ISP if you’re not sure if your IP address is fixed or dynamic.

Fixed IP

If your internet service includes a fixed IP, this next steps are pretty simple.

  1. Find out what the IP address is. e.g.
  2. Log into the control panel for your domain.
  3. Look for an option to create or modify DNS records
  4. Create an A record.
    • The Domain section will be the bare domain you just bought – e.g.
    • The Data is your fixed IP address e.g.
  5. Create a CNAME record
    • Domain: e.g.
    • Data: e.g.
  6. Save all the changes, and after a little while (could be seconds, could be hours) you’ll be able to get at your website from outside your home network! Try on your phone with wifi switched off (so you’re using your mobile (cellular) data.

Dynamic IP

This means every time your router connects to the internet, it could have a different IP address. This means an A record with a fixed IP like above won’t work.

You’ll need use a Dynamic DNS Service to get around this.

Each of these has two parts:

  • An online service
    • There are lots of services, is a large and well respected one with a free service level and a linux client.
  • An update client – a program running on a device on your network that tells the online service where it is.
    • This could run on anything – your router might be able to run it – have a look through it’s documenation and see if your chosen Dynamic DNS service is supported.

So the steps are:

  1. Pick a Dynamic DNS Service and sign up.
  2. Create a domain name within their system e.g. It doesn’t matter what name you choose.
  3. Either configure your router with your account details, or follow your chosen service’s instructions to install & configure the client on your server.
  4. You should be able to see if it’s working by logging into the Service and checking what the IP is and when it was last updated. It should show your public IP address.
  5. Log into the control panel for your domain.
  6. Look for an option to create or modify DNS records
  7. Create a CNAME record
    • Domain: e.g.
    • Data: e.g. (that you created above)
  8. Save all the changes, and after a little while (could be seconds, could be hours) you’ll be able to get at your website from outside your home network! Try on your phone with wifi switched off (so you’re using your mobile (cellular) data.

Tidying up

Once you’ve verified that that you can get at your website from outside your network, I’d recommend removing the entry in your client’s hosts file. This means that when your client tries to access your website, it’ll use the public IP address (instead of the private IP address inside your network). However, your router should be smart enough to realise that, and direct the request to your server. This may be marginally slower, but it’ll make it easier to catch and fix DNS or router issues when inside your network.

Leave a Reply

Your email address will not be published. Required fields are marked *