Opening our home Xampp web server to the internet

In a previous article we have installed Xampp on Elementary OS and we could already see from our local network the default main page of the server by typing in the navigation bar of our browser http://localhost

The first thing we need is a domain name of our own to be visible through that domain name from the internet.

We can hire this domain from different providers or create a new free domain name for example through NoIP, which is what we are going to do.

NoIP is actually going to provide us with a free subdomain but this is enought for our purpose.

We will need to register on NoIP from here

Once registered on the NoIP page, we will display DynamicDNS and click on Create Hostname

We fill in the form with the domain name and subdomain that we prefer, the only restriction is that it is not previously registered, NoIP will inform us about it if necessary

Congratulations, we have our subdomain created, for example HomeServer.ddns.net where HomeServer is the subdomain and ddns.net is the domain.

Our home Internet Services Provider (ISP) generally provide us with dynamic external IP.

This external IP is the IP that the provider assigns to our router with which we reach the internet.

Dynamic external IP means that it is not always the same, our external IP changes, for example when we turn off and on the router.

NoIP needs to know our external IP continuously so that the DNS service can assign it to our new domain, in our example HomeServer.ddns.net or the name you have chosen.

For example: HomeServer.ddns.net could refer to the external IP 83.88.18.23

For this, NoIP provides us with the DUC client that constantly notifies to NoIP our external IP, in our example 83.88.18.23 and when it changes, DUC notifies NoIP.

Follow the NoIP instructions below to install:

How to Install the Linux Dynamic Update Client DUC on Ubuntu

this works for both Ubuntu and Elementary OS that derives from Ubuntu

Once we have solved with DUC the fact that our external IP is dynamic, we face another problem, that most Internet providers ISP reserve port 80, which is the port on which the Apache server that we have installed with Xampp listens by default.

There is no major problem either, we will change the port on which Apache listens as follows, in the Xampp Control Panel we click on configure and change port 80 to 81 for example, or if you prefer we can also edit the file /opt/lamp/etc/httpd .conf whith an editor as administrator, for example with the command

sudo io.elementary.code

and then open from the editor the file /opt/lamp/etc/httpd.conf

In any of these ways, we change port 80 to 81, now with the Stop button we stop Apache Web Server and with the Restart button we restart it on port 81.

Well this is almost done, we are just missing a couple of things.

We have to open ports 80 and 81 in our router and direct the traffic that comes to port 80 to 81, let me explain if someone from the internet writes on the navigation bar of their browser HomeServer.ddns.net goes to the http port by default 80 from our brand new server.

To go to port 81 you must type HomeServer.ddns.net:81.

To avoid that visitors to our portal the annoyance to write: 81 we redirect the traffic coming from the default port 80 to 81 on our router.

To do this we write in the navigation bar of the browser the internal IP of our router, in my case 192.168.1.1 (it is the gateway of my network, because the IP address of my server is 192.168.1.95 the IP address of my router will be 192.168.1.1)

The internal IP address of your router by default is written on a sticker attached to your router and also the password to access.

Once in your router, this varies according to models and providers we enter the configuration menu ports generally in the menu option NAT (Network Address Translator) and here we open ports 80 and 81 and redirect port 80 to 81, on my router it looks like this:

192.168.1.95 is the internal IP address of my internet Xampp server

Now we type from outside our network in the navigation bar of the browser HomeServer.ddns.net

When I say from outside, I mean without being connected to the home network or WiFi, for example with the mobile phone using 4G or 5G not connected to our home WiFi or from a friend’s house.

The home page of our internet server must be displayed on the browser.

If we cannot access to our server now from outside, it is because the ports in the Elementary OS firewall are closed.

In case that we cannot access to our server, we will open ports 80 and 81 with the command:

sudo ufw allow 80: 81 / tcp

If ufw is not installed in our Elemetary OS, we install it with the following commands:

sudo apt update

sudo apt upgrade

sudo apt-get install ufw

sudo apt install ufw

and now we run again the command

sudo ufw allow 80: 81 / tcp

We then write again from outside our network in the navigation bar of the browser HomeServer.ddns.net and voila we can see the home page of our server from internet.

Deja una respuesta

Tu dirección de correo electrónico no será publicada.