Get Apache online when ISP blocks port 80
Posted on 11-02-2011 00:00
I bet you already know, that once you setup Apache, anyone can access your /var/www folder, just by typing your ip address in firefox's navigation bar.
But what happens when your ISP (Internet Service Provider) blocks port 80? (Port 80 is the default port http requests use)
First of all, check whether your ISP is blocking your port here.
(You need to have apache up and running, for this to work, since apache comes configured to port 80 by default.)
If your port isn't forwarded properly this online tool will let you know.
In this case the most common reason is that your ISP is blocking it: Most residential ISP's block ports to "protect" their customers from viruses and spam. The most commonly blocked ports are port 80 and port 25.
In my opinion though, they are doing it just because they don't want anyone being able to host his own online server under a very cheap dynamic ip connection.
Lets see how we override this!
Except port 80 and 25, they usually block ports 1-1024 as well, so we need to pick a port outside of this range. I will pick 8080 for the purposes of this tutorial.
Now we need to configure apache to operate using this port:
- Change configuration in ports.conf file:
su nano /etc/apache2/ports.conf
(don't close this terminal since all the following commands require root privileges)
Change lines 8, 9 to:
NameVirtualHost *:8080 Listen 8080
save and close nano.
- Change configuration in default file:
Change the first line to:
save and close nano.
- Restart apache!:
Now lets visit canyouseeme.org and see if it worked.
Type in the box under your ip 8080 and then check.If it worked you should get the message:
Success: I can see your service on xxx.xxx.xxx.xxx on port (8080) Your ISP is not blocking port 8080
(Where xxx.xxx.xxx.xxx your IP)
Now everyone can visit your /var/www folder just by typing your ip and port you used, like that: xxx.xxx.xxx.xxx:8080
UPDATE : You might need to set your pc to be DMZ on your router settings: By visiting http://192.168.1.1/ you have access to your router. (applies on most routers)
Find where the DMZ section is and set your computer's local address to be a DMZ:
The DMZ host feature allows one local host to be exposed to the Internet for a special-purpose service such as Internet gaming or videoconferencing. DMZ host forwards packets of all services.
Any PC that is set to be DMZ host must have its DHCP client function disabled and should have a new static local IP address assigned to it because its local IP Address may change when using the DHCP function.
The above tutorial is suggested for users that want to test stuff on apache or experiment on and with it and they don't want (or can't afford) to pay extra cash. It is NOT suggested for users that don't know what they are doing or can't protect their computer, since everyone that knows your IP and port can have remote access to your computer and harm it!