Question

Question about setting up port for HTTP server

Hello, I was able to port forward for a TCP socket server I am running on a droplet, however I cannot seem to do the same for my HTTP server. I used the following commands to allow access to my TCP server:

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 37842 -j DNAT --to-destination 10.124.0.2:37842 iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

This allowed access for tcp connections on the port 37842 and I was able to connect to it. However, when I try to set up an HTTP server on port 8000, I get Not Found (404) errors. I try to access the HTTP server with http://<public-ip>:8000/ but am unsuccessful. I have tried different ways of using iptables to forward the port and get access to my application, but nothing seems to reach it. I am asking how to modify my iptables commands to allow access to my http server from the public ip address when it is hosting off of http://10.124.0.2:8000/ ?

Thanks


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up