This article will guide you through the steps of enabling access to your web server from a computer outside of your network by using your computer’s external IP address.
- Configure Apache’s httpd.conf
- Enable port forwarding
- Add incoming rules on Windows Firewall
Apache needs to be configured to listen to our port from all IP Address, not just our localhost.
Open up httpd.conf, found in the conf folder of your Apache installation directory.
Look for the following lines, making sure that
Listen 80 is specified.
# # Listen: Allows you to bind Apache to specific IP addresses and/or # ports, instead of the default. See also the <VirtualHost> # directive. # # Change this to Listen on specific IP addresses as shown below to # prevent Apache from glomming onto all bound IP addresses. # #Listen 18.104.22.168:80 Listen 80
Save the file and restart Apache.
Enabling Port Forwarding
Login to your default gateway (http://192.168.0.1) and navigate to Port Forwarding.
You will need to port forward 80 (the default port for Apache) to the local IP address of your computer.
If you are using MySQL, you will also need to port forward 3306 (the default port for MySQL).
Configuring Windows Firewall
Finally, if you have your firewall turned on, you will need to add a rule to the firewall to allow connections being made to port 80.
Follow these steps:
- Navigate to Control Panel > System and Security > Windows Firewall > Advanced Settings.
- Right click “Inbound Rules” on the left pane.
- Choose “New Rule”.
- Choose “Port”.
- Choose “TCP”, and under “Specific ports” enter your port number (80).
- Continue with “Next” until the end of the wizard, naming the rule when asked.
For MySQL access, repeat the steps above but for port 3306 (or whatever port your MySQL service is running on).
To verify that you can now access your web server using your external IP from a different network, visit http://canyouseeme.org/ and specify to check port 80.