Score:0

nginx windows: website only reachable with localhost, not when using IP-address

es flag

I am running an nginx (v. 1.20.1) proxy on my windows machine. The following is the nginx.conf:

http {
  include       mime.types;
  default_type  application/octet-stream;

  sendfile        on;
  keepalive_timeout  65;

  server {
      listen       *:80;
      server_name  localhost;

    
      location / {
          proxy_pass http://localhost:9000;
      }

      error_page   500 502 503 504  /50x.html;
      location = /50x.html {
          root   html;
      }
  }
}

When I type localhost in my browser I get the correct response.

When I use my IP-adress however it says that the website can not be reached.

I've tried allowing external access on port 80 as well as access for the nginx.exe in the Windows Defender Firewall. I also deactivated the firewall in my Kaspersky Internet Security.

Any ideas what the problem is?

djdomi avatar
za flag
`server_name localhost;` means Listen for "localhost" and nothing else - either use \_default\_ meaning an invalid name to listen to any names or use like server_name localhost 192.168.1.1;
Score:0
ke flag

you need to enable ip access control to access it.

check this link for more steps: link and this link

IceRevenge avatar
es flag
First links seems like an approach but I don't want to whitelist any ip-addresses. What if I want it to be open for everyone? I tried adding only my ip-address but now calling `localhost` leads to `403 Forbidden`. Because of the second link I added `_` for `server_name` but it didn't help.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.