Enabling External Access to Your Apache Web Server on Windows 7

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.

Steps

  1. Configure Apache’s httpd.conf
  2. Enable port forwarding
  3. Add incoming rules on Windows Firewall

Configuring Apache

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 12.34.56.78: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).

For a D-Link router, the port forwarding
For a D-Link router, your port forwarding settings should look something like this.

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:

  1. Navigate to Control Panel > System and Security > Windows Firewall > Advanced Settings.
  2. Right click “Inbound Rules” on the left pane.
  3. Choose “New Rule”.
  4. Choose “Port”.
  5. Choose “TCP”, and under “Specific ports” enter your port number (80).
  6. 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).

Verifying

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.

Voila! External access is enabled and working.
Voila! External access is enabled and working.

Leave a Reply

Your email address will not be published. Required fields are marked *