How To Forward Ports To Your Ubuntu 12.04 LTS LAMP Server
This how-to is a wrapper for the fantastic portforwarding help site www.portforward.com
To support, and make it very easy for, those who want to set up a home server on an ubuntu 12.04 LTS server running LAMP
I will assume you have installed ubuntu 12.04 LTS with LAMP and are trying to setup a webserver and need to do a port forward for port 80. Perhaps you followed the great how to for LAMP on ubuntu 12.04 at http://www.ubuntugeek.com/step-by-step-ubuntu-12-04-precise-lamp-server-setup.html.
While we're at it we'll choose a setup to do port 443 as well so we could potentially host websites on https later. Once you've gone through the process you can repeat it for any ports you may require as defined by the service you are trying to serve to the internet.
First determine your home servers IP address and host name. In a terminal type
Now you should see a line in the eth0 or eth1 section starting with "inet" eg
inet addr:192.168.1.91 Bcast:192.168.1.255 Mask:255.255.255.0
Note down the number after addr: - eg "192.168.1.91" This is the <IP address> of your ubuntu server. You may need it later during the port forward process. (NB: NOT the one after BCAST or MASK and not one beginning with 127)
Now we will get the host name. In a terminal type
Note down the result - it's the <server host name> of your server. You may need this rather than the IP address during the port forward process.
In a browser go to http://portforward.com
- Click "free guides"
- Select your modem/router brand
- Click to "close" the ad for PFConfig
- Select your model of modem/router
- Select "Apache" to set up the ports for your web server. FYI the A in "LAMP" stands for "Apache".
Now follow the instructions, hopefully you can get through them and open the ports to your ubuntu home server.
You shouldn't need to use the software they offer and you can test if you were successfull by attempting to visit your own website (if you have one) using a browser. eg
Or go to http://www.whatsmyip.org/ then copy down your external IP address given to you at the top where is says for eaxmple
Your IP Address is 220.127.116.11
Now copy the number into your browser in this example go to
But obviously use the number givin to you by whatsmyip not the number I used in the example.
have successfully installed an Ubuntu server LAMP stack and have
successfully pointed your port forward to it then you should see an "IT
If not you can see which of your ports are open by visiting http://www.whatsmyip.org/port-scanner/ and clicking "check ports" under servers. It will take a while and at the end you should see a green line indicating port 80 is open
You can also see if your Ubuntu server is ready to accept connections on any port by going to the terminal and typing
netstat -an| grep 0.0.0.0|grep LISTEN|grep :
The number after the red colon is the port the server is waiting for connections on.
Good luck, I hope you enjoy hosting your own server from home.