NGINX not binding to localhost:80 only 127.0.0.1:80
Bill Culp
bill.culp at me.com
Thu Dec 20 21:14:44 UTC 2012
lsof says NGINX is listening on localhost
nginx 3315 root 8u IPv4 0xfd9b22b8ee1eac23 0t0 TCP localhost:http (LISTEN)
When I run another web server on that port localhost works fine but not with this NGINX config.
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
error_log var/log/nginx/error.log info;
pid var/log/nginx/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#######################################
# Perl ImageMagick Resize
#perl_modules perl/lib;
#perl_require resize.pm;
#server {
# location / {
# root /var/www;
# if (!-f $request_filename) {
# rewrite ^(.*)(.jpg|.JPG|.gif|.GIF|.png|.PNG)$ /resize$1$2 last;
# }
# }
# location /resize {
# perl resize::handler;
# }
#}
################################ End Perl Image Resize
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen localhost:80;
server_name localhost;
#charset koi8-r;
access_log var/log/nginx/host.access.log main;
location / {
root share/nginx/html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root share/nginx/html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root share/nginx/html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443;
# server_name localhost;
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_timeout 5m;
# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root share/nginx/html;
# index index.html index.htm;
# }
#}
}
On Dec 20, 2012, at 1:10 PM, Jonathan Matthews <contact at jpluscplusm.com> wrote:
> On 20 December 2012 20:41, Bill Culp <bill.culp at me.com> wrote:
>> Ive had this issue with tomcat apache in the past and always fixed it by specifying localhost as part of the listen directive - not working with NGINX on OS X.
>>
>> NGINX is responding to 127.0.0.1 - but localhost it just drops the connection (its not refusing the connection, just dropping it)…
>>
>> Is there a way to fix this I have tried listen *:80, listen localhost:80 and still I cant reach it through the browser using localhost.
>>
>> localhost is resolvable with ping and has its entry in the hosts file.
>
> Posting your configuration would probably help people diagnose your
> issue more easily ...
>
> Jonathan
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
More information about the nginx
mailing list