0

TL;DR: simple HTTP server is accessible locally, but how can I make it available remotely in order to view the served files from another computer on the network?

I'm using a zero-configuration command line HTTP server to serve up a web site (a directory containing an index.html file).

I use either python -m SimpleHTTPServer or the node.js http-server (installed from npm).

Accessing the web site locally is fine. If I serve the site on port 8090, then I can see it at localhost:8090 as expected.

But I'm unable to access it remotely, and herein lies my problem. I'd like the web site to be accessible on my network. (I have to be on VPN to access the server.)

If I try to telnet to the port, I get telnet: connect to address 192.168.122.215: Connection refused.

Btw, port 8080 is already being used by Jenkins, which is why I'm using 8090 (not sure if that makes any difference).

I've seen https://stackoverflow.com/questions/14469267/node-js-on-mac-access-a-node-js-web-server-from-another-computer, but it doesn't help. When I run the command http-server . -p 8090 I get Starting up http-server, serving . on: http://0.0.0.0:8090, which I believe means it should be accessible remotely.

I'm not really very familiar with networking/ports/etc so any guidance is greatly appreciated. I assume it's something to do with the port not being open, or some firewall setting, but this is alien to me.

Is what I'm trying to do possible? Can anyone help me make this web site available remotely on the network? Thanks for reading!

Sam
  • 103
  • 4

1 Answers1

1
  1. Run netstat -lpn and verify that the web server port you want to use is in deed running on 0.0.0.0 instead of localhost. If it's not then we need to edit the configs to listen on "*" and then restart the web server daemon.

  2. If you have a firewall on your machine, just for a few minutes here to troubleshoot, turn it completely off so that we can eliminate it as a source of our problem. If we find that firewall is the problem we can make sure the right rules are in there for the port your working on.

Ethode
  • 200
  • 10
  • 1
    Thanks for your reply. It turns out I was being a complete muppet, which is very embarrassing. I have an `alias` for connecting via SSH so never type in the IP when connecting, and then I was getting my IP addresses mixed up. I spent ages trying to figure out what was wrong, and in the end it turned out to be my brain that was at fault. Anyway, it was when I ran `netstat` that I noticed the Local Address, then checked my `alias` and realised my mistake. So it was your question that led me to the solution. – Sam Apr 12 '15 at 20:08
  • 17 years doing web development, and I still find my self doing completely idiotic things.. It never ends, keeps you humble lol – Ethode Apr 13 '15 at 00:21