Welcome to Centmin Mod Community
Become a Member

Nginx My nginx is down

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by Umit, Feb 22, 2018.

  1. Umit

    Umit Member

    39
    5
    8
    Nov 15, 2016
    Ratings:
    +5
    Local Time:
    1:43 AM
    hi, my nginx is down

    when i "systemctl status nginx.service" i get
    Starting SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server...
    Starting nginx: nginx: [emerg] unknown directive "more_set_headers" in /usr/local/nginx/conf/nginx.conf:41
    [FAILED]
    ginx.service: control process exited, code=exited status=1


    how can i fix this?
     
  2. eva2000

    eva2000 Administrator Staff Member

    36,049
    7,909
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,191
    Local Time:
    8:43 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Did you customise your nginx install and disable some nginx modules in persistent config file at /etc/centminmod/custom_config.inc ?

    what is output contents of /etc/centminmod/custom_config.inc ?
    Code (Text):
    /etc/centminmod/custom_config.inc
    

    looks like you disabled Nginx OpenResty Headers Module nginx module which is required for Centmin Mod out of box nginx configuration.
     
  3. Umit

    Umit Member

    39
    5
    8
    Nov 15, 2016
    Ratings:
    +5
    Local Time:
    1:43 AM

    Hi Eva, thank you for your answer.
    here:
    LETSENCRYPT_DETECT='y'
    NGXDYNAMIC_NGXPAGESPEED='y'
    NGINX_PAGESPEED='y'
    MARCH_TARGETNATIVE='n'


    as far as i noticed, my linode went out of space. and that must caused something..
    it is quite weird actually.
    i updated centmin menu #4 (nginx)
    and my websites are back

    BUT my xf website is not working.

    "Chris D" says "Your MySQL server is refusing the connection that XF is trying to make. "

    when i try to visit my xf website i get http500 error,
    when i try to upgrade my xf from 2.0.1 to 2.0.2 it gives
    "XF\Db\Exception: No such file or directory in src/XF/Db/Mysqli/Adapter.php at line 160"

    how can i check whats wrong?
     
  4. eva2000

    eva2000 Administrator Staff Member

    36,049
    7,909
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,191
    Local Time:
    8:43 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
  5. Umit

    Umit Member

    39
    5
    8
    Nov 15, 2016
    Ratings:
    +5
    Local Time:
    1:43 AM
    i deleted a 16gb file, it should be ok now
    Filesystem Type Size Used Avail Use% Mounted on

    /dev/root ext4 47G 26G 19G 59% /

    devtmpfs devtmpfs 2.0G 0 2.0G 0% /dev

    tmpfs tmpfs 2.0G 0 2.0G 0% /dev/shm

    tmpfs tmpfs 2.0G 9.5M 2.0G 1% /run

    tmpfs tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup

    /dev/loop0 ext4 5.8G 25M 5.5G 1% /tmp

    tmpfs tmpfs 394M 0 394M 0% /run/user/0


    what can i do now?
    a wordpress site is working fine, a html website working just fine but my xf website is down.
     
  6. Umit

    Umit Member

    39
    5
    8
    Nov 15, 2016
    Ratings:
    +5
    Local Time:
    1:43 AM
    actually, the wordpress website giving errors too
    "Error establishing a database connection"

    it was looking OK because it has a caching plugin on..
     
  7. Umit

    Umit Member

    39
    5
    8
    Nov 15, 2016
    Ratings:
    +5
    Local Time:
    1:43 AM
    so, there is something wrong with the mysql.. how can i check whats wrong?
     
  8. Umit

    Umit Member

    39
    5
    8
    Nov 15, 2016
    Ratings:
    +5
    Local Time:
    1:43 AM
    service mysql restart

    Restarting mysql (via systemctl): Job for mariadb.service failed because the control process exited with error code. See "systemctl status mariadb.service" and "journalctl -xe" for details.

    [FAILED]

    Feb 21 19:45:45 server.pictuts.com mysqld[26072]: 2018-02-21 19:45:45 140404954020096

    InnoDB: Percona XtraDB (Experts in Database Performance Management) 5.6.36-82.2 started; log sequence number 328147782

    Feb 21 19:45:45 server.pictuts.com mysqld[26072]: 2018-02-21 19:45:45 140403890190080

    InnoDB: Dumping buffer pool(s) not yet started

    Feb 21 19:45:45 server.pictuts.com mysqld[26072]: 2018-02-21 19:45:45 140404954020096

    Plugin 'FEEDBACK' is disabled.

    Feb 21 19:45:45 server.pictuts.com mysqld[26072]: 2018-02-21 19:45:45 140404954020096

    Recovering after a crash using tc.log

    Feb 21 19:45:45 server.pictuts.com mysqld[26072]: 2018-02-21 19:45:45 140404954020096 [ERROR] Can't init tc log

    Feb 21 19:45:45 server.pictuts.com mysqld[26072]: 2018-02-21 19:45:45 140404954020096 [ERROR] Aborting

    Feb 21 19:45:47 server.pictuts.com systemd[1]: mariadb.service: main process exited, code=exited, status=1/FAILURE

    Feb 21 19:45:47 server.pictuts.com systemd[1]: Failed to start MariaDB database server.

    Feb 21 19:45:47 server.pictuts.com systemd[1]: Unit mariadb.service entered failed state.

    Feb 21 19:45:47 server.pictuts.com systemd[1]: mariadb.service failed.

     
  9. Umit

    Umit Member

    39
    5
    8
    Nov 15, 2016
    Ratings:
    +5
    Local Time:
    1:43 AM
    i solved.
    I ended up deleting the tc.log file in /var/lib/mysql. When I started mysql again, it created a new tc.log and started up.
     
  10. eva2000

    eva2000 Administrator Staff Member

    36,049
    7,909
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,191
    Local Time:
    8:43 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Looks like you crashed mysql server - which can possibly corrupt your mysql databases if you run out of disk. So I'd double check everything.
     
  11. Umit

    Umit Member

    39
    5
    8
    Nov 15, 2016
    Ratings:
    +5
    Local Time:
    1:43 AM
    what can be my next step? how can i check?
     
  12. eva2000

    eva2000 Administrator Staff Member

    36,049
    7,909
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,191
    Local Time:
    8:43 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Unfortunately, not something I can guide you through as more extensive as only you would know whether mysql database is intact. I'd make a full mysql databse(s) backup of all your databases ASAP and download them for safe keeping first and inspect mysql error log for further error clues you can see before and after mysql server start up. Also probably comparing it with a backup database.

    You can check your mysql error log FAQ item 19
     
  13. Umit

    Umit Member

    39
    5
    8
    Nov 15, 2016
    Ratings:
    +5
    Local Time:
    1:43 AM
    Eva, so sorry to bother you... it went down again...
    i checked and saw this:
    Starting nginx: nginx: [emerg] duplicate location "/src/" in /usr/local/nginx/conf/conf.d/iamtravelr.com.ssl.conf:92

    and i commented the lines as:
    #location /src/ {
    # internal;
    # allow 127.0.0.1;
    # deny all;
    #}

    restarted the nginx and sites back.. did i do this correctly?
     
  14. eva2000

    eva2000 Administrator Staff Member

    36,049
    7,909
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,191
    Local Time:
    8:43 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    depends on full contents of /usr/local/nginx/conf/conf.d/iamtravelr.com.ssl.conf
    use cat to output contents
    Code (Text):
    cat /usr/local/nginx/conf/conf.d/iamtravelr.com.ssl.conf
    

    for posting code you might want to use CODE tags for code How to use forum BBCODE code tags :)
     
  15. Umit

    Umit Member

    39
    5
    8
    Nov 15, 2016
    Ratings:
    +5
    Local Time:
    1:43 AM
    Code (Text):
    #x# HTTPS-DEFAULT
    server {
     
      server_name iamtravelr.com www.iamtravelr.com;
      return 302 https://$server_name$request_uri;
    }
    
    server {
      listen 443 ssl http2;
      server_name iamtravelr.com www.iamtravelr.com;
    
      include /usr/local/nginx/conf/ssl/iamtravelr.com/iamtravelr.com.crt.key.conf;
      include /usr/local/nginx/conf/ssl_include.conf;
    
      http2_max_field_size 16k;
      http2_max_header_size 32k;
      # mozilla recommended
      ssl_ciphers ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS;
      ssl_prefer_server_ciphers   on;
      #add_header Alternate-Protocol  443:npn-spdy/3;
    
      # before enabling HSTS line below read centminmod.com/nginx_domain_dns_setup.html#hsts
      #add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
      #add_header X-Frame-Options SAMEORIGIN;
      #add_header X-Xss-Protection "1; mode=block" always;
      #add_header X-Content-Type-Options "nosniff" always;
      #spdy_headers_comp 5;
      ssl_buffer_size 1369;
      ssl_session_tickets on;
     
      # enable ocsp stapling
      resolver 8.8.8.8 8.8.4.4 valid=10m;
      resolver_timeout 10s;
      ssl_stapling on;
      ssl_stapling_verify on;
    
    # 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/iamtravelr.com/log/access.log combined buffer=256k flush=5m;
      error_log /home/nginx/domains/iamtravelr.com/log/error.log;
    
      include /usr/local/nginx/conf/autoprotect/iamtravelr.com/autoprotect-iamtravelr.com.conf;
      root /home/nginx/domains/iamtravelr.com/public;
      # uncomment cloudflare.conf include if using cloudflare for
      # server and/or vhost site
      include /usr/local/nginx/conf/cloudflare.conf;
      include /usr/local/nginx/conf/503include-main.conf;
    
      location / {
      try_files $uri $uri/ /index.php?$uri&$args;
      index index.php index.html;
    
      # return 302 https://iamtravelr.com/pages/home/;
    
      include /usr/local/nginx/conf/503include-only.conf;
    
    # 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;
    
      # Wordpress Permalinks example
      #try_files $uri $uri/ /index.php?q=$uri&$args;
    
      }
    
    location /install/data/ {
        internal;
    }
    location /install/templates/ {
        internal;
    }
    location /internal_data/ {
        internal;
    }
    location /library/ {
        internal;
        allow 127.0.0.1;
        deny all;
    }
    #location /src/ {
    #    internal;
    #    allow 127.0.0.1;
    #    deny all;
    #}
    
    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass    127.0.0.1:9000;
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include         fastcgi_params;
    }
    
      include /usr/local/nginx/conf/pre-staticfiles-local-iamtravelr.com.conf;
      include /usr/local/nginx/conf/pre-staticfiles-global.conf;
      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;
      include /usr/local/nginx/conf/vts_server.conf;
    }
    
    
     
  16. Umit

    Umit Member

    39
    5
    8
    Nov 15, 2016
    Ratings:
    +5
    Local Time:
    1:43 AM
    what i can see is only i need to uncomment cloudflare as i am not using it. I cant see anything else wrong, anyone else?
     
  17. eva2000

    eva2000 Administrator Staff Member

    36,049
    7,909
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,191
    Local Time:
    8:43 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    If on Centmin Mod 123.09beta01, you may have ran into the new tools/autoprotect.sh cronjob feature outlined at Beta Branch - autoprotect.sh - apache .htaccess check & migration to nginx deny all | Centmin Mod Community Your uploaded scripts in /src directory may have .htaccess deny from all type files in their directories which may need bypassing autoprotect. It's a security feature that no other nginx based stack has as far as I know :)

    So instead, all .htaccess 'deny from all' detected directories now get auto generated Nginx equivalent location /src match and deny all setups so end up with duplicate. Except if you want to manually bypass the directory from auto protection via a .autoprotect-bypass file - details below here so you can bypass /src in autoprotect and restore/uncomment /src location in vhost instead.
     
  18. Umit

    Umit Member

    39
    5
    8
    Nov 15, 2016
    Ratings:
    +5
    Local Time:
    1:43 AM
    Eva thank you, so as far as i understand, my action was enough, right? ( autoprotect file stays untouched)
    or whats the difference between i comment the lines on autoprotect conf file and normal confd file above?
     
  19. eva2000

    eva2000 Administrator Staff Member

    36,049
    7,909
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,191
    Local Time:
    8:43 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    also contents of /usr/local/nginx/conf/autoprotect/domain.com/autoprotect-domain.com.conf ?
    Code (Text):
    cat /usr/local/nginx/conf/autoprotect/domain.com/autoprotect-domain.com.conf
    
     
  20. Umit

    Umit Member

    39
    5
    8
    Nov 15, 2016
    Ratings:
    +5
    Local Time:
    1:43 AM
    Code (Text):
    # Xenforo bypass /home/nginx/domains/iamtravelr.com/public/library
    
    # location /library/ {
    #   internal;
    #   allow 127.0.0.1;
    #   deny all;
    # }
    
    # https://community.centminmod.com/posts/35394/
    # /home/nginx/domains/iamtravelr.com/public/src
    
    location /src/ {
      location ~ ^/src/(.+/)?(.+)\.(js)$ { allow all; expires 30d; }
      location ~ ^/src/(.+/)?(.+)\.(css)$ { allow all; expires 30d; }
      location ~ ^/src/(.+/)?(.+)\.(gif|jpe?g|png|webp|eot|svg|ttf|woff|woff)$ { allow all; expires 30d; }
      location ~ ^/src/(.+/)?(.+)\.(php|cgi|pl|php3|php4|php5|php6|phtml|shtml)$ { allow 127.0.0.1; deny all; }
    }
    
    # Xenforo bypass /home/nginx/domains/iamtravelr.com/public/install/templates
    
    # Xenforo bypass /home/nginx/domains/iamtravelr.com/public/install/data
    
    
     
..