You do not need to change the port Apache is listening at all! In my case, Apache listens at port 80 normally.
Configure all routers and modems (some modems have an internal router, such as DLINK) to receive some unusual ports as '8081' to '8082' AND redirect those requests to the IP where your apache server is running, at the port 80. Avoid to use 8080, 8081 or higher.
Put the hosts (both networks) in the DMZ (host at "DEMILITARIZED ZONE", in other words, out of policies)
There are 2 networks in my case:
- 10.1.1.1 (modem)
- 192.168.1.1 (wireless router)
Suppose a modem router whose network is
10.1.1.1 and the Apache PC is AT
You must configure NAT - Virtual Servers acessing
10.1.1.1 / NAT / Virtual Servers:
PortStart......PortEnd......type....... dest IP........ dest PORT
...8081..........8082........TCP...... 10.1.1.5............... 80
10.1.1.5 ← the UP used by the Apache PC network. To get it, run
ipconfig at cmd prompt.
For the secondary router (wireless) whose network is
DMZ Host: 192.168.1.10 ← IP of the PC running Apache in the wireless router subnet.
To preview the site, do not use your home wireless or or a computer connected to your home network, because all you will see is the modem's router page. You must access your site from outside the home network (ex: use your mobile GSM internet, never WiFi).
The scheme to access the site, so, lets suppose the current internet IP is
Remember, Apache is still listening at port 80. Who does the magic are the routers, especially the first (modem) that redirects the ports. NAT – Virtual Servers. DMZ is also essential. For both router configurations.