-1

I install nginx as a reverse proxy. If I use:

proxy_pass http://127.0.0.1:81

it does not work. But if I use:

proxy_pass http://domain.com:81

it works. And I can use browser to access to http://domain.com:81 and http://ip:81

Could anyone explain for me?

Khaled
  • 36,533
  • 8
  • 72
  • 99
KingOfDCP
  • 7
  • 1
  • 2
  • What happens if you "telnet 127.0.0.1 81"? It should give you a connected message. –  Dec 08 '11 at 09:58
  • In fact, my port I want is 8080 and this is result telnet: 127.0.0.1:8080: Name or service not known 127.0.0.1:8080: Unknown host – KingOfDCP Dec 08 '11 at 10:19
  • Define "does not work". Do you get an error? Do you get the wrong answer from the server? Do you get nothing at all? – Gerald Schneider Dec 24 '16 at 07:20

2 Answers2

0

The telnet command I gave shouldn't have a colon. It should be "telnet 127.0.0.1 8080". It it doesn't work then I would guess whatever web server you're using isn't being bound to 127.0.0.1 and/or port 8080.

Tim
  • 31,888
  • 7
  • 52
  • 78
  • "telnet 127.0.0.1 8080" command worked. Connected to 127.0.0.1. Escape character is '^]'. So what's the problem here. I already stuck – KingOfDCP Dec 08 '11 at 12:08
0

I couldn't find reason why it doesn't work, but what if you try like this:

proxy_pass http://localhost:81