I'm currently in the process of setting up a web server just for personal and testing use. Right now I'm trying out running some python applications but when I start them, they are ran at 127.0.0.1:5000. Is there anyway I can forward this to make it accessible elsewhere?
|
feedback
|
|
You will need to make the web server listen on all interfaces / network interfaces. Otherwise, it just listens on localhost (127.0.0.10 by default. You could provide more details about your server / dev environment for more specific help. | |||
|
feedback
|
|
First you will need an interface and a LAN IP address. Once you have those, you should be able to configure that network on your dev box, then restart your python apps. They will typically listen on all interfaces unless configured otherwise. I'm not a python expert. Confirm with netstat or lsof. Then you should be able to connect from another LAN host as the client by entering the LAN IP address from above as the destination. Beyond that, you'll need some way to connect to the WAN and do some NAT to allow connections from the internet at large. One final note, check your firewall(s). You may well have a listener going but the firewall is not going to allow port 5000 unless you configure it for such. | |||
|
feedback
|
|
As the forwarding part has not been addressed by any of the previous answers yet: you can easily forward local ports using SSH:
This will forward all TCP traffic from port 5000 of your local machine to the localhost-bound port 5000 of your.testing.web.server. The beauty of this setup is that it only allows access for users who are able to authenticate with This of course is not going to help you if you expect your site to be publicly available, but would clearly be my first preference "for personal and testing use". | |||||
feedback
|
|
Thanks everyone for your help, but I found out a way to solve it. I figured out I didn't need to forward the localhost, just run the python/flask app publicly. So I just had to add host='0.0.0.0' to the app.run and it was able to work. | |||
|
feedback
|