corporate-gadfly / Tunlr-Clone

302 stars 57 forks source link

HTTP and HTTPS server on ports 80 and 443 #15

Closed blazejpawlak closed 11 years ago

blazejpawlak commented 11 years ago

Should it still be possible to host a web server serving port 80 and 443? I had nginx running and after applying iptables rules the web server sized to be available.

corporate-gadfly commented 11 years ago

Sorry.. don't know enough about nginx

blazejpawlak commented 11 years ago

It appears to be related to those two iptables rules

iptables -t nat -A PREROUTING -i venet0 -p tcp --dport 80 -j DNAT --to 172.y.y.y:8080
iptables -t nat -A PREROUTING -i venet0 -p tcp --dport 443 -j DNAT --to 172.y.y.y:8443

It applies to any webserver running on the same machine and hosting on ports 80 and 443.

blazejpawlak commented 11 years ago

Uhm, it seems that this can be easily fixed if one has a server with more than one public IP. The you could do:

iptables -t nat -A PREROUTING -i venet0 -p tcp -d 173.x.x.x --dport 80 -j DNAT --to 172.y.y.y:8080
iptables -t nat -A PREROUTING -i venet0 -p tcp -d 173.x.x.x --dport 443 -j DNAT --to 172.y.y.y:8443

Where 173.x.x.x is server's another public IP. The one that was used for DNS configuration. Other public IP has to be used for web hosting. Perhaps there is room for improvement in the sniproxy configuration.