Discover Centmin Mod 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:11 AM
    1.13
    • CentOS Version: Centos 7 64Bit
    • Centmin Mod Version Installed: 123.08stable
    • Nginx Version Installed: nginx/1.15.2
    • PHP Version Installed: PHP 5.6.38 (cli)
    • MariaDB MySQL Version Installed: 10.0.36-MariaDB

     
  2. eva2000

    eva2000 Administrator Staff Member

    40,620
    9,014
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,880
    Local Time:
    4:11 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    how old is the 123.08stable install ? nginx spdy was deprecated years ago for nginx http/2
    what is output for
    Code (Text):
    nginx -V

    post output in CODE tags

    make sure you update 123.08stable and recompile nginx

    Upgrading Centmin Mod Code to Latest Version



    Getting Started Guide step 19 outlines also how to keep Centmin Mod code updated or how to switch version branches or you can run cmupdate command that was recently added.

    Centmin Mod LEMP stack's script code is constantly updated for improvements, bug fixes and security fixes so keeping the Centmin Mod code up to date is important. With Centmin Mod 1.2.3-eva2000.08) (123.08stable) and higher releases, a newly added centmin.sh menu option 23 allows much easier code updates and version branch switching via Git backed environment you can setup.

    For 123.08stable that means centmin.sh menu option 23 submenu option 2 (if you previously ran submenu option 1) first, then exit centmin.sh, re-enter /usr/local/src/centminmod and re-run centmin.sh menu.

    For 123.09beta01 and higher that means running SSH command = cmupdate and then re-enter /usr/local/src/centminmod and re-run centmin.sh menu.

    Example of using 123.09beta01 cmupdate command to update Centmin Mod code on your server
    Code (Text):
    cmupdate
    No local changes to save
    Updating 5f92047..9d06ee8
    Fast-forward
     stackscripts/stackscript.sh | 11 ++++++++---
     1 file changed, 8 insertions(+), 3 deletions(-)
    


    For full details read the following links:
    Upgrading Centmin Mod involves 2 parts.
    1. Upgrading the actual Centmin Mod code outlined at Upgrade Centmin Mod. This is heart of Centmin Mod where the code is the engine that runs centmin.sh shell based menu and all the automation you're accustomed to. You can easily update within a Centmin Mod version branch or switch version branches via centmin.sh menu option 23 outlined here.
    2. Upgrade software that Centmin Mod installed or manages. For this part following outline at How to upgrade Centmin Mod software installed on your server.
     
  3. congthanh

    congthanh New Member

    28
    0
    1
    Oct 25, 2018
    Ratings:
    +0
    Local Time:
    1:11 AM
    1.13
    Dear sir,
    i just update nginx and get error

    then i check nginx -t and get
    Thank you
     
    Last edited: Apr 20, 2019
    style="display:inline-block;min-width:400px;max-width:970px;width:95%;height:90px" data-ad-client="ca-pub-6669518204467592" data-ad-slot="4024536743" data-ad-format="auto">
  4. eva2000

    eva2000 Administrator Staff Member

    40,620
    9,014
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,880
    Local Time:
    4:11 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    To troubleshoot, you need to check the full nginx upgrade log at /root/centminlogs and instructions under Sharing logs and errors heading for using Pastebin.com or Gists to share a sanitised version of the contents of the nginx_upgrade.log log. You can see full details at How to troubleshoot Centmin Mod initial install issues

    also what's output of
    Code (Text):
    nginx -t

    when you run centmin.sh menu option 4 there's a nginx upgrade log timestamped at /root/centminlogs

    if you type this command it lists all logs in date ascending order so latest log at bottom
    Code (Text):
    ls -lArt /root/centminlogs

    so copy the entire contents of latest nginx_upgrade log to gist.github.com or pastebin.com

    you can use grep to filter the logs, i.e. look for nginx_upgrade in log name
    Code (Text):
    ls -lahrt /root/centminlogs/ | grep nginx_upgrade
    -rw-r--r--  1 root root 3.2M Oct 11 15:55 centminmod_1.2.3-eva2000.09.001_111016-155345_nginx_upgrade.log
    -rw-r--r--  1 root root 672K Oct 11 22:06 centminmod_1.2.3-eva2000.09.001_111016-220515_nginx_upgrade.log

    So the last nginx upgrade log was named centminmod_1.2.3-eva2000.09.001_111016-220515_nginx_upgrade.log and located at /root/centminlogs/centminmod_1.2.3-eva2000.09.001_111016-220515_nginx_upgrade.log

    then use cat command to output the contents of that log

    clear your ssh window buffer/screen and type
    Code (Text):
    cat /root/centminlogs/centminmod_1.2.3-eva2000.09.001_111016-220515_nginx_upgrade.log

    then select and copy and paste output to pastebin.com or gist.github.com file to share. If your SSH client's scroll buffer isn't large enough using cat might not output the entire log file contents, so you may need to download the log and use local text editor to open and copy and paste.

    so only need content of one specific log, in this case most recent nginx_upgrade.log log
     
  5. congthanh

    congthanh New Member

    28
    0
    1
    Oct 25, 2018
    Ratings:
    +0
    Local Time:
    1:11 AM
    1.13
    Dear Sir,

    My nginx_upgrade https://paste.ofcode.org/cS8Kuvr78VVFdz94EdyKuY

    Nginx -t
    Thank you
     
  6. eva2000

    eva2000 Administrator Staff Member

    40,620
    9,014
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,880
    Local Time:
    4:11 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    the link isn't fully loading for me unfortunately - try pasetbin.com or gist.github.com
     
  7. congthanh

    congthanh New Member

    28
    0
    1
    Oct 25, 2018
    Ratings:
    +0
    Local Time:
    1:11 AM
    1.13
    nginx update centminmod
     
  8. eva2000

    eva2000 Administrator Staff Member

    40,620
    9,014
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,880
    Local Time:
    4:11 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    in /usr/local/nginx/conf/conf.d/nhaxinhmytho.com.ssl.conf comment out these 2 options with hash in front
    Code (Text):
    #add_header Alternate-Protocol  443:npn-spdy/3;
    #spdy_headers_comp 5;
    
     
  9. congthanh

    congthanh New Member

    28
    0
    1
    Oct 25, 2018
    Ratings:
    +0
    Local Time:
    1:11 AM
    1.13
    Dear Sir,
    I disable before.
     
  10. eva2000

    eva2000 Administrator Staff Member

    40,620
    9,014
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,880
    Local Time:
    4:11 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    the nginx upgrade log says it's enabled
     
  11. congthanh

    congthanh New Member

    28
    0
    1
    Oct 25, 2018
    Ratings:
    +0
    Local Time:
    1:11 AM
    1.13
    Dear Sir,
    But still now i disable 2 options.
    When i nprestart i get
    When i nginx -t
    Thank you
     
  12. eva2000

    eva2000 Administrator Staff Member

    40,620
    9,014
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,880
    Local Time:
    4:11 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    output for
    Code (Text):
    ngxrestart; sleep 5; journalctl -xe -u nginx --no-pager | tail -100 | sed -e "s|$(hostname -f)|hostname|g" -e "s|$(hostname -s)|hostname|g"
    
     
  13. congthanh

    congthanh New Member

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

    Output
     
  14. eva2000

    eva2000 Administrator Staff Member

    40,620
    9,014
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,880
    Local Time:
    4:11 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    you already have a service i.e. varnish server running on port 80 conflicting with nginx trying to start up on port 80 - so problem is nothing to do with centmin mod but your configuration of varnish cache server and improperly configuring nginx listen port to a port other than 80 - which is already occupied by varnish cache server
     
  15. congthanh

    congthanh New Member

    28
    0
    1
    Oct 25, 2018
    Ratings:
    +0
    Local Time:
    1:11 AM
    1.13
    Dear sir,
    I try to change port nginx to 8080 in "virtual.conf"
    then i nprestart and check port of nginx
    Port 80 is listening
    How can i change nginx to 8080

    Thank you
     
  16. eva2000

    eva2000 Administrator Staff Member

    40,620
    9,014
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,880
    Local Time:
    4:11 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    check that all nginx nginx's listen directives are no using 80 using command below to list nginx vhost files with listen port 80 referenced
    Code (Text):
    grep -rin 'listen' /usr/local/nginx/conf/conf.d/  | grep -v '#' | grep ' 80 '

    and check any listen directives which are not referencing a port other than 443, 8080 and 80 as blank listener default to port 80
    Code (Text):
    grep -rin 'listen' /usr/local/nginx/conf/conf.d/  | grep -v '#' | egrep -v ' 8080 | 80 | 443 '
     
    Last edited: Apr 20, 2019
  17. congthanh

    congthanh New Member

    28
    0
    1
    Oct 25, 2018
    Ratings:
    +0
    Local Time:
    1:11 AM
    1.13
    Last edited: Apr 20, 2019
  18. congthanh

    congthanh New Member

    28
    0
    1
    Oct 25, 2018
    Ratings:
    +0
    Local Time:
    1:11 AM
    1.13
    I
    Code (Text):
    grep -rin 'listen' /usr/local/nginx/conf/conf.d/  | grep -v '#' | grep ' 80 '

    it's empty
    then i
    Code (Text):
    grep -rin 'listen' /usr/local/nginx/conf/conf.d/  | grep -v '#' | egrep -v ' 8080 | 80 | 443 '

    But 2 nginx is running, a use port 80, use port 8080
     
    Last edited: Apr 20, 2019
  19. eva2000

    eva2000 Administrator Staff Member

    40,620
    9,014
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,880
    Local Time:
    4:11 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    checked /usr/local/nginx/conf/conf.d/demodomain.com.conf ?
     
  20. eva2000

    eva2000 Administrator Staff Member

    40,620
    9,014
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,880
    Local Time:
    4:11 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    ok to find and list all nginx vhosts which do not have a listen directive, use this SSH command
    Code (Text):
    find /usr/local/nginx/conf/conf.d/ -type f -not -exec grep -H -E -o -c  "listen"  {} \; | grep :0\$ | sed -e 's/..$//'
    

    example output reports that /usr/local/nginx/conf/conf.d/test.com.conf nginx vhost doesn't have a listen directive which in case that server_name will default to nginx port 80 usage. So if you need to change all nginx vhosts to port other than 80, you need to add the listen directive into that nginx vhost i.e. test.com.conf reported as not having one.
    Code (Text):
    find /usr/local/nginx/conf/conf.d/ -type f -not -exec grep -H -E -o -c  "listen"  {} \; | grep :0\$ | sed -e 's/..$//'
    /usr/local/nginx/conf/conf.d/test.com.conf
    

    so if test.com.conf has blank listen directive it defaults to port 80
    Code (Text):
    server {
    
                server_name test.com;
    

    so if you need to change to port 8080, you'd specifically set a listen directive
    change to
    Code (Text):
    server {
                listen   8080;
                server_name test.com;