I have a public IP on the server (Amazon AWS - Ubuntu Server) - let's say 11.12.13.14.

When you enter in the browser (on the server) - http: // localhost there are no problems, the page works. But on another computer in the browser http://11.12.13.14 displays - "Can not access the site." How can I redirect - http://11.12.13.14 to http: // localhost in apache.

Or for this I need a domain, that is, it is not possible to access the site only by entering IP into the address bar.

Please explain in more detail.

  • one
    If there is access to the IP address from the external network, but not from the local network, then masquerading is needed on the router. If there is nowhere, then the IP address is not very old (less than a day). Describe your configuration in more detail. - AlexGlebe
  • @AlexGlebe From local access is, and from external is not. And another 80 port is closed. - ruslan4742

1 answer 1

  1. Do not forget to configure your apache https and dns-name, ip-address. That is, we assume that your apache-server ip address is 192.168.0.51/24.
  2. If you refuel with a public ip-address, then configure on your server, where the following public address is bolted:

    iptables -A PREROUTING -d 11.12.13.14/32 -i eth0 -p tcp -m tcp -m multiport --dports 22,80,443 -j DNAT --to-destination 192.168.0.51

This will redirect traffic to your local server. 3. If not you manage the settings of the external address, ask those from whom it is available to redirect traffic to your local machine.


In principle, everything is simple. Always remember, if you have a local network with addressing (192.168.0.1/24) and you have a public address, then you need to redirect traffic from external ip to internal ip.