Learn about Centmin Mod LEMP Stack today
Register Now

Nginx I get error when i start service varnish

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by congthanh, Apr 20, 2019.

Tags:
  1. congthanh

    congthanh New Member

    28
    0
    1
    Oct 25, 2018
    Ratings:
    +0
    Local Time:
    1:49 AM
    1.13
    i deleted demodomain.com.conf before

     
  2. congthanh

    congthanh New Member

    28
    0
    1
    Oct 25, 2018
    Ratings:
    +0
    Local Time:
    1:49 AM
    1.13
  3. eva2000

    eva2000 Administrator Staff Member

    59,369
    12,513
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,149
    Local Time:
    4:49 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    for posting code or output from commands to keep the formatting, you might want to use CODE tags for code How to use forum BBCODE code tags :)

    looks like none of those files are the problem

    i'd manually inspect all your nginx vhosts to see if a listen directive exists as it's still most common reason nginx is listening on port 80 and 8080
     
  4. congthanh

    congthanh New Member

    28
    0
    1
    Oct 25, 2018
    Ratings:
    +0
    Local Time:
    1:49 AM
    1.13
  5. eva2000

    eva2000 Administrator Staff Member

    59,369
    12,513
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,149
    Local Time:
    4:49 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    if your domain's .ssl.conf vhost files have http to https redirect server{} context then those are listening on port 80 so need to comment those out
     
  6. congthanh

    congthanh New Member

    28
    0
    1
    Oct 25, 2018
    Ratings:
    +0
    Local Time:
    1:49 AM
    1.13
    Dear sir,

    Code:
    tcp        0      0 0.0.0.0:http            0.0.0.0:*               LISTEN      4463/nginx: master
    tcp        0      0 0.0.0.0:webcache        0.0.0.0:*               LISTEN      4463/nginx: master
    tcp        0      0 0.0.0.0:https           0.0.0.0:*               LISTEN      4463/nginx: master
    
    i see webcache. i think it's using port 80...
     
  7. eva2000

    eva2000 Administrator Staff Member

    59,369
    12,513
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,149
    Local Time:
    4:49 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    what does output for nginx config test say
    Code (Text):
    nginx -t
     
  8. congthanh

    congthanh New Member

    28
    0
    1
    Oct 25, 2018
    Ratings:
    +0
    Local Time:
    1:49 AM
    1.13
    Dear Sir,
    Code:
    [root@li1777-43 ~]# nginx -t
    nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
    
     
  9. eva2000

    eva2000 Administrator Staff Member

    59,369
    12,513
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,149
    Local Time:
    4:49 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    and output for
    Code (Text):
    netstat -plant | grep nginx
     
  10. congthanh

    congthanh New Member

    28
    0
    1
    Oct 25, 2018
    Ratings:
    +0
    Local Time:
    1:49 AM
    1.13
    Dear sir,
    Code:
    [root@li1777-43 ~]# netstat -plant | grep nginx
    tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      4249/nginx: master
    tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      4249/nginx: master
    tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      4249/nginx: master
    
     
  11. eva2000

    eva2000 Administrator Staff Member

    59,369
    12,513
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,149
    Local Time:
    4:49 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    strange it means you still have a nginx vhost listening on port 80 somewhere - maybe in custom include file you added ?

    maybe try disabling each /usr/local/nginx/conf/conf.d listed nginx vhost one by one and checking netstat to see if it's related to a specific nginx vhost
     
  12. congthanh

    congthanh New Member

    28
    0
    1
    Oct 25, 2018
    Ratings:
    +0
    Local Time:
    1:49 AM
    1.13
    Dear Sir,
    I just disable "#include /usr/local/nginx/conf/conf.d/*.conf;" in nginx.conf.
    then i use
    Code:
    netstat -plant | grep nginx
    Output nothing
     
  13. eva2000

    eva2000 Administrator Staff Member

    59,369
    12,513
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,149
    Local Time:
    4:49 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    yeah because you disabled all nginx vhosts hence empty netstat output
     
  14. congthanh

    congthanh New Member

    28
    0
    1
    Oct 25, 2018
    Ratings:
    +0
    Local Time:
    1:49 AM
    1.13
    i know which file config use port 80, but i changed listen 8080 but i don't know why it's using 80
    Code:
    server {
                listen   8080;
                server_name csdldoanhnghiep.com;
                return 301 $scheme://www.doanhnghiep.com$request_uri;
           }
    
    server {
      server_name csdldoanhnghiep.com www.doanhnghiep.com;
     
  15. eva2000

    eva2000 Administrator Staff Member

    59,369
    12,513
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,149
    Local Time:
    4:49 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    that's why blank/missing listener in server{} context = default port 80 so add listen 8080 in that server{} context !
    Code (Text):
    server {
      server_name csdldoanhnghiep.com www.doanhnghiep.com;