user2769651
user2769651

Reputation: 171

How to connect over the net to a local server?

I have a ngnix server set up and running locally for some development testing. I want to be able to connect to it over the net. I have a device on the local network that I want to connect to the server with. How would I do this? The device and my comp are both connected in a VPN. The VPN gives me an ip address. Shouldn't the device be able to connect to that ip address since localhost and the ip are the same?

server {
    listen       8080;
    server_name  localhost;

    #access_log  logs/host.access.log  main;

    location / {
    root   html;
    index  index.html index.htm;
    }

Upvotes: 0

Views: 67

Answers (2)

Kad
Kad

Reputation: 398

There is a big diffrence from localhost (127.0.0.1) and the computers IP address
for example:(192.168.80.10) The diffrence is that localhost is only accessable from your computer.

You'll have to use your computers IP address when you want to connect from a diffrent machine over your local network (or in your case a VPN solution). To get your computers IP address for windows:

  1. Press start.
  2. type in cmd into the search bar.
  3. when a black console shows up, type in ipconfig
  4. Look for IPV4-address, and to the right is your computers local IP.

You might not need to change the config files of the server, because the server might be automaticly set up to listen to your local IP. I would suggest trying to conenct localy with your local IP address before trying to change configuration files.

Hope this helped!
-kad

Upvotes: 0

Brightshine
Brightshine

Reputation: 965

If your server only listen on localhost(127.0.0.1), other machines have no way to access your server.

You must listen on a specific IP, and other machines can connect to your server through this IP.

Upvotes: 1

Related Questions