why is nginx binding to 0.0.0.0:80 when I specify explicit IPs to listen on?

middleforkgis nginx-forum at nginx.us
Tue Jan 22 22:15:54 UTC 2013


I'm having a difficult time understanding why I'm unable to limit the IP
address to which nginx binds.

nginx                          1.2.6-1
Linux 3.2.0-4-amd64 #1 SMP Debian 3.2.35-2 x86_64 GNU/Linux


================
root at skokomish:/etc/nginx# netstat -pant |grep nginx
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN  
   7768/nginx      
tcp        0      0 66.113.100.140:81       0.0.0.0:*               LISTEN  
   7768/nginx      

shows that it is binding on port 80 of all IP addresses.
=================
Yet each of my hosts is explicitly listening on a single IP address:

root at skokomish:/etc/nginx/sites-available# more default
{ listen 127.0.0.1:80; }
=================
root at skokomish:/etc/nginx/sites-available# more example
server
{
    server_name example.com www.example.com;
    listen 66.113.100.140:80;
    access_log /var/log/ngnix/example.log;
    error_log /var/log/nginx/example.error.log;

   location /site {
   	alias /data/www/content/site/example;
	}  
   location / {
        proxy_pass_header Server;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Scheme $scheme;
        proxy_connect_timeout 10;
        proxy_read_timeout 10;
       	proxy_pass http://10.15.20.10:8107/;
    }	
}


==========================
There is no 'listen' statement in nginx.conf itself:
root at skokomish:/etc/nginx# grep listen nginx.conf
#		listen     localhost:110;
#		listen     localhost:143;
==========================
Grepping for 'listen' shows:

root at skokomish:/etc/nginx# for i in `find .`; do grep listen $i;
done|sort|uniq
grep: .: Is a directory
grep: ./sites-enabled: Is a directory
grep: ./conf.d: Is a directory
grep: ./sites-available: Is a directory
{ listen 127.0.0.1:80; }
    listen 66.113.100.140:80;
	listen 66.113.100.140:81;
#		listen     localhost:110;
#		listen     localhost:143;
root at skokomish:/etc/nginx# ls conf.d
root at skokomish:/etc/nginx# 

==================================
Thanks in advance.

-Steve W.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,235428,235428#msg-235428



More information about the nginx mailing list