Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

4 Answers

As the forwarding part has not been addressed by any of the previous answers yet: you can easily forward local ports using SSH:

    ssh user@your.testing.web.server -L 5000:127.0.0.1:5000

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 sshd and the SSH protocol would encrypt all your traffic.

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".

share|improve this answer
    
Ok, that will help for some testing, but part of what I'm doing is writing some stuff using Twilio. For that, I need to enter my "SMS URL", so that when a number is texted to my Twilio number, it feeds the information to that website. I doubt this solution would work for such a thing. –  Aaronneyer Jan 13 '12 at 17:34
    
As I stated, it would not. In this case, you should rephrase your question to "how do I bind my network service <specific name / version> to my public interface instead of 127.0.0.1?" –  the-wabbit Jan 13 '12 at 17:37
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment
up vote 0 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.