how to use $host variable in proxy_pass

hirenshah.05 nginx-forum at
Wed Dec 28 19:42:40 UTC 2011

I tried this,

server {
listen 80;
server_name "";

location / {

proxy_pass https://$host; //gives error. And $host value is same like
above hostname ""
proxy_redirect off;


but still not working. If I check error log it says,

375#0: recv() failed (111: Connection refused) while resolving,

Thanks for your help.


Posted at Nginx Forum:,220619,220627#msg-220627

More information about the nginx mailing list