Have a little confusion with Nginx config as reverse proxy

Status
Not open for further replies.

KingOfDCP

Active Member
485
2010
39
0
Hello,

I install nginx as a reverse proxy. If I use
PHP:
proxy_pass http://127.0.0.1:port
, it does not work. But if I use
PHP:
proxy_pass domain:port
, it works. Even I can use browser to access
PHP:
http://ip:port
.

Could anyone explain for me?
 
4 comments
I will assume you have apache as backend server. if so

you need to pass "Host: header to apache so it knows what domain to serve"

try to add this into your nginx conf

Code:
proxy_set_header   Host   $host;

Highest Regards
Mohammed H
 
Hello,

ok so you are passing requests to http://127.0.0.1: port .

are you sure Apache is listneing on that IP and Port.

also try to pass requests to your VPS/Server public IP not 127.0.0.1

also if it didn't work either can you post VirtualHost directive of apache here?

Highest Regards
Mohammed H
 
Last edited:
Status
Not open for further replies.
Back
Top