0

Added alias ip, creating eth0:0. network restarted,
ngix is listened on alias ip:

server {
        listen   alias.ip:80;

From server machine I can access www using

# lynx http://alias.ip/

How to forward port/redirect(?) ?

zion
  • 51
  • 1
  • 3

1 Answers1

0

No port forwarding is required. Make sure your DNS names point at alias.ip, and it should work. If alias.ip is an internal IP address and you need this to be available on the public internet, then the same rules apply as for any other IP address. Example (to be put into iptables on gateway that does the forwarding):

iptables -t nat -A PREROUTING -p tcp -d 123.234.0.1 --dport 8080 -j DNAT --to-destination <alias.ip>:80

This will forward incoming requests to port 8080 on IP address 123.234.0.1 to port 80 on your alias IP. Obviously for this to work, the public DNS must point to 123.234.0.1, and the users must know that they have to use port 8080 in their browser requests.

You may also need other iptables rules to allow incoming traffic on port 8080, etc...

wolfgangsz
  • 8,767
  • 3
  • 29
  • 34
  • And how to explain this - from server where I am installing "alias.ip" I can access my own www, but from home machine - can't. For sure that no forwarding is required? – zion May 26 '11 at 22:09
  • OK, it's time for you to update your original post with some more information about the networks involved here, and the IP addresses used. Are your home machine and the server hosting the site on the same network? – wolfgangsz May 26 '11 at 22:39
  • Server hosting! Can't access from outside. – zion May 27 '11 at 01:18