Discover Centmin Mod today
Register Now

Nginx Nginx vhost missing listen 80?

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by pamamolf, Jul 5, 2014.

Tags:
  1. pamamolf

    pamamolf Well-Known Member

    2,450
    220
    63
    May 31, 2014
    Ratings:
    +377
    Local Time:
    8:24 AM
    Nginx-1.11.x
    MariaDB 10
    Hi

    I just create a new vhost and i check the config and i got this:

    Code:
    # redirect from non-www to www
    # uncomment, save file and restart Nginx to enable
    #server {
    #  listen  80;
    #  server_name mydomain.com;
    #  return 301 $scheme://www.mydomain.com$request_uri;
    #  }
    
    server {
      server_name mydomain.com www.mydomain.com;
    
    # ngx_pagespeed & ngx_pagespeed handler
    #include /usr/local/nginx/conf/pagespeed.conf;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/mydomain.com/log/access.log combined buffer=32k;
      error_log /home/nginx/domains/mydomain.com/log/error.log;
    
      root /home/nginx/domains/mydomain.com/public;
    
      location / {
    
    # block common exploits, sql injections etc
    #include /usr/local/nginx/conf/block.conf;
    
      # Enables directory listings when index file not found
      #autoindex  on;
    
      # Shows file listing times as local time
      #autoindex_localtime on;
    
      # Enable for vBulletin usage WITHOUT vbSEO installed
      #try_files     $uri $uri/ /index.php;
    
      }
    
      include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/php.conf;
      include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
    }
    
    
    So as i do not use the redirect from non-www to www i keep the comments there.

    But on the test domain config i can see this:

    Code:
    server {
       listen  80;
      server_name mydomain.com www.mydomain.com;
    
    But the listen 80 is missing here on my main domain config above ......

    It seems that i am very unlucky after doing it more than 20 times to not be able now to get it working :(
     
  2. eva2000

    eva2000 Administrator Staff Member

    27,774
    6,336
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,339
    Local Time:
    3:24 PM
    Nginx 1.13.x
    MariaDB 5.5
    it defaults to listen 80 if listen 80 is omitted so shouldn't be a problem and works for me
     
  3. RoldanLT

    RoldanLT Well-Known Member

    3,787
    928
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,252
    Local Time:
    1:24 PM
    1.11
    10.2
    Yes it's not required unless you have ssl/443 port also.