To allow access from others on the internet to your server you need to make it public. In this guide we will set your internal IP as static, open the correct port, and publish it under a domain. We will also make it more secure by adding SSL.

Please give us feedback if there is anything you think we should add to the guide, or if there is something we can improve. Have fun!

  1. LOG IN TO YOUR ROUTER FROM YOUR BROWSER

    Type the address to your router in the browser window. It’s usually 192.168.1.1 or 192.168.0.1 depending on your router and settings.

    Some routers have a sticker on the back with the routers address.

    gateway

  2. OPEN PORT 80 OR 443

    Go to your port configuration on your router and open port 80 or 443 on the internal IP that you will use as static. Once you’ve done that you should test if the port is open for traffic. Here is a free tool that you can use.

  3. BUY A DOMAIN

    Choose the domain name that you want to use. CityNetwork is both cheap and reliable. Visit their site and see if the domain name you want is available:  https://www.citysites.eu/register-domain/

    This is the one we use as our DNS and it works great! The cost is about 13 USD / year. You will also get mailboxes so that you can use your own domain as an email-address, i.e [email protected]

  4. GO TO  WHATSMYIP.ORG

    Get your external IP adress. Then add your external IP to your CityNetwork Setup.

  5. Add your external IP to Citynetwork

    CityNetwork will act as your DNS for the domain, and you have to add your external IP to the DNS settings to be able to reach your server from outside.

    cn1

    Note: Most ISPs doesn’t provide a static external IP, but as long as you don’t shut down your router for a longer period of time, the external IP shouldn’t change. If it does, you have to manually add it to your domain provider’s DNS settings. You could also set up a DynDNS software on your server that keeps the same IP at all times.

  6. Wait for the DNS to propagate

    Normally this takes around 12 hours. If you want to check the status, you can enter your domain name here. Meanwhile, you can continue this guide.

  7. Add your domain to /etc/hosts
    :~$ sudo nano /etc/hosts

    It should look something like this:hosts

  8. Get a SSL cert

    For better security we advice you to buy an SSL cert. You can get one for a trial period of 90 days. When the trial period is due, you can buy a cert for only 4.95 € / year. If you are using the ownCloud or Nextcloud VM you can simply just run this command:

    $~: sudo bash /var/scripts/activate-ssl.sh

    The script will automatically create a virtual host and activate it, so you don’t have to continue with the following steps.

    SSL-1
  9. Install SSL on the server

    On Apache you install the certs in

    /etc/ssl/
  10. MAKE A VIRTUAL HOST

    You have to let the server know where your folders and files that you want to publish are located. Without a Virtual Host the server won’t be able to access your site because it won’t find it.

  11. Visit your site

    When the DNS is propagated you can test if it works by visiting your site, https://example.com.



Pro Tip

If you host a regular website, then Cloudflare protects your server. Check it out!