Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been having trouble debugging my issues on my own local port 80 listeners when trying to set up an nginx webserver. I am simply just trying to see the vanilla "welcome to nginx" start page and the only way I see it is if I change the listen option in the config under http to something other than 80 (i.e 81)

So my question is: How do you go about debugging issues on port 80 (there is a duplicate question, but the accepted answer is not related to this I believe)

Things I have done to try and trace the issue (I am in no way a linux expert):

-I checked netstat, theres definitely an nginx listener on port 80.

-turned on logging in the nginx config, tailed the access.log and debug.log. Nothing unusual comes up (and in fact nothing shows up in access.log)

-when I do ping localhost (or I get a response, but when I try a telnet or in a browser, I don't get anything. (telnet returns connection refused)

My theories: something to do with ipv6/ipv4 and the etc/hosts file, or something to do with nsswitch

anyways, I am at a loss, any suggestions will be greatly appreciated.

edit: result of netstat -nltp | grep nginx

tcp        0      0    *               LISTEN      24211/nginx: master 


#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/;

events {
    worker_connections  1024;

http {
    include       mime.types;
    default_type  application/octet-stream;

    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  logs/access.log; 
        error_log logs/error.log info;
    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen      80; 
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   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   html;

        # proxy the PHP scripts to Apache listening on
        #location ~ \.php$ {
        #    proxy_pass;

        # pass the PHP scripts to FastCGI server listening on
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass;
        #    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   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   html;
    #        index  index.html index.htm;
    #    }

share|improve this question
What is the problem you are having? And what is your configuration? – Michael Hampton May 16 '13 at 5:14
What distro of linux you are using? If Deb based check for service apache2 status and if it is RPm based check for service httpd status if both of th e commands says running then stop it change the port in your Nginx conf file to 80 and restart Nginx and try to browse and see if you get your nginx Welcome page or not. – Abhishek Anand Amralkar May 16 '13 at 5:16
my problem is nginx serves external requests on port 81 but not port 80. I am using Ubuntu 12.04. I don't have apache installed. Like i said in the post, nginx is in fact listening on port 80, and i can ping localhost and get a response, but something through the browser or a telnet request gets refused. – treehau5 May 16 '13 at 12:36
Run the following command, # netstat -nltp | nginx and post your result. Also copy the whole nginx.conf file or a link of you configuration, we can't troubleshoot or help if you don't supply information! thanks – Danie May 16 '13 at 12:45
ALSO IPTABLES - might you be using iptables? – Danie May 16 '13 at 12:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.