Want more timely Centmin Mod News Updates?
Become a Member

Beta Branch switch back from custom nginx main_ext log format to default combined

Discussion in 'Centmin Mod Github Commits' started by eva2000, May 16, 2017.

  1. eva2000

    eva2000 Administrator Staff Member

    30,149
    6,782
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,133
    Local Time:
    11:25 PM
    Nginx 1.13.x
    MariaDB 5.5
  2. ethanpil

    ethanpil Active Member

    168
    47
    28
    Nov 8, 2015
    Ratings:
    +87
    Local Time:
    11:25 PM
    Why did you change the log format?
     
  3. eva2000

    eva2000 Administrator Staff Member

    30,149
    6,782
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,133
    Local Time:
    11:25 PM
    Nginx 1.13.x
    MariaDB 5.5
    You mean originally ? it was to support nginx amplify monitoring https://community.centminmod.com/threads/nginx-amplify-open-source-monitoring-service.4963/ so that you get extended support stats/metric monitoring out of the box. But seems at least for Centmin Mod users, nginx amplify didn't really take off anyway. So switching back to nginx default makes more sense with fail2ban implementation work https://community.centminmod.com/threads/fail2ban-for-centmin-mod-csf-firewall-cloudflare-api.11687/

    technically, you could have 2 access logs one for default combined and one for main_ext log formats if you wanted

    How to monitor NGINX: Get real-time diagnostics for your apps

    upload_2017-5-16_23-24-20.png
     
  4. pamamolf

    pamamolf Well-Known Member

    2,720
    242
    63
    May 31, 2014
    Ratings:
    +433
    Local Time:
    4:25 PM
    Nginx-1.13.x
    MariaDB 10.1.x
    Do we have manually to do that ?
     
  5. eva2000

    eva2000 Administrator Staff Member

    30,149
    6,782
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,133
    Local Time:
    11:25 PM
    Nginx 1.13.x
    MariaDB 5.5
    yes for existing nginx vhosts not for newly created nginx vhosts
     
  6. pamamolf

    pamamolf Well-Known Member

    2,720
    242
    63
    May 31, 2014
    Ratings:
    +433
    Local Time:
    4:25 PM
    Nginx-1.13.x
    MariaDB 10.1.x
    What exactly we must edit?
     
  7. eva2000

    eva2000 Administrator Staff Member

    30,149
    6,782
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,133
    Local Time:
    11:25 PM
    Nginx 1.13.x
    MariaDB 5.5
    change log format back from main_ext to combined on all access log directives in nginx vhosts
     
    • Informative Informative x 1
  8. ljseals

    ljseals Member

    88
    22
    8
    Dec 20, 2016
    Ratings:
    +43
    Local Time:
    8:25 AM
    ON a test server and made a new vhost and got this error.
    Code (Text):
    Restarting nginx (via systemctl):  Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
                                                               [FAILED]
    Gracefully shutting down php-fpm . done
    Starting php-fpm  done
    [root@vps129708 public]# nginx -t
    nginx: [emerg] unknown log format "buffer=256k" in /usr/local/nginx/conf/conf.d/test.domain.com.conf:29


    Fresh install cannot make a new vhost without nginx error.
     
  9. eva2000

    eva2000 Administrator Staff Member

    30,149
    6,782
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,133
    Local Time:
    11:25 PM
    Nginx 1.13.x
    MariaDB 5.5
    • Like Like x 1
  10. ljseals

    ljseals Member

    88
    22
    8
    Dec 20, 2016
    Ratings:
    +43
    Local Time:
    8:25 AM
    Thanks Eva2000, I read that thread but it fails on a fresh install without touching anything but creating a new vhost.
     
  11. eva2000

    eva2000 Administrator Staff Member

    30,149
    6,782
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,133
    Local Time:
    11:25 PM
    Nginx 1.13.x
    MariaDB 5.5
    how was vhost created ?

    when did you install 123.09beta01 ?

    what output do you get when you run
    Code (Text):
    cd /usr/local/src/centminmod
    git stash
    git pull
    grep -r '\/access.log'
    grep -r '\/access.log' /usr/local/nginx/conf/conf.d
    
     
  12. ljseals

    ljseals Member

    88
    22
    8
    Dec 20, 2016
    Ratings:
    +43
    Local Time:
    8:25 AM
    It seems that if I comment out the log file or if I change it per the requirements that it still gives the error with the line being in the config file.

    Code (Text):
    [14:10][root@srv3.domain.com ~]# cd /usr/local/src/centminmod
    [14:11][root@srv3.domain.com centminmod]# git stash
    Saved working directory and index state WIP on 123.09beta01: 499f330 update memcache admin and zend opcache admin routines
    HEAD is now at 499f330 update memcache admin and zend opcache admin routines
    [14:12][root@srv3.domain.com centminmod]# git pull
    Already up-to-date.
    [14:12][root@srv3.domain.com centminmod]# grep -r '\/access.log'
    config/nginx/nginx.conf:access_log  logs/access.log combined buffer=128k flush=5m;
    config/nginx/conf.d/demodomain.com.conf:            access_log /home/nginx/domains/demodomain.com/log/access.log ;
    tools/nv.sh:  access_log /home/nginx/domains/$vhostname/log/access.log $NGX_LOGFORMAT buffer=256k flush=60m;
    tools/nv.sh:  access_log /home/nginx/domains/$vhostname/log/access.log $NGX_LOGFORMAT buffer=256k flush=60m;
    tools/nv.sh:  access_log /home/nginx/domains/$vhostname/log/access.log $NGX_LOGFORMAT buffer=256k flush=60m;
    tools/nv.sh:  access_log /home/nginx/domains/$vhostname/log/access.log $NGX_LOGFORMAT buffer=256k flush=60m;
    tools/nv.sh:  access_log /home/nginx/domains/$vhostname/log/access.log $NGX_LOGFORMAT buffer=256k flush=60m;
    tools/nvwp.sh:  access_log /home/nginx/domains/$vhostname/log/access.log $NGX_LOGFORMAT buffer=256k flush=60m;
    tools/nvwp.sh:  access_log /home/nginx/domains/$vhostname/log/access.log $NGX_LOGFORMAT buffer=256k flush=60m;
    tools/nvwp.sh:  access_log /home/nginx/domains/$vhostname/log/access.log $NGX_LOGFORMAT buffer=256k flush=60m;
    inc/nginx_addvhost.inc:  access_log /home/nginx/domains/$vhostname/log/access.log $NGX_LOGFORMAT buffer=256k flush=60m;
    inc/nginx_addvhost.inc:  access_log /home/nginx/domains/$vhostname/log/access.log $NGX_LOGFORMAT buffer=256k flush=60m;
    inc/nginx_addvhost.inc:  access_log /home/nginx/domains/$vhostname/log/access.log $NGX_LOGFORMAT buffer=256k flush=60m;
    inc/wpsetup.inc:  access_log /home/nginx/domains/$vhostname/log/access.log $NGX_LOGFORMAT buffer=256k flush=60m;
    inc/wpsetup.inc:  access_log /home/nginx/domains/$vhostname/log/access.log $NGX_LOGFORMAT buffer=256k flush=60m;
    inc/wpsetup.inc:  access_log /home/nginx/domains/$vhostname/log/access.log $NGX_LOGFORMAT buffer=256k flush=60m;
    addons/acmetool.sh:  access_log /home/nginx/domains/$vhostname/log/access.log $NGX_LOGFORMAT buffer=256k flush=60m;
    addons/acmetool.sh:  access_log /home/nginx/domains/$vhostname/log/access.log $NGX_LOGFORMAT buffer=256k flush=60m;
    changes.html:  <li>Updated nginx.conf and vhost template to add a 32K buffer to access_log logging. Changes aren't updated automatically, you will need to update the <b>/usr/local/nginx/conf/nginx.conf</b> manually to remove line <b>log_format bytes_log "$msec $bytes_sent .";</b> and add the line <b>access_log logs/access.log combined buffer=32k;</b>. You can compare using download zip's copy at <b>config/nginx/nginx.conf</b> to compare against your live servers copy</li>
    [14:12][root@srv3.domain.com centminmod]#
     
  13. eva2000

    eva2000 Administrator Staff Member

    30,149
    6,782
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,133
    Local Time:
    11:25 PM
    Nginx 1.13.x
    MariaDB 5.5
    and
    Code (Text):
    grep -r '\/access.log' /usr/local/nginx/conf/conf.d
    
     
  14. ljseals

    ljseals Member

    88
    22
    8
    Dec 20, 2016
    Ratings:
    +43
    Local Time:
    8:25 AM
    Code (Text):
    [14:12][root@srv3.domain.com centminmod]# grep -r '\/access.log' /usr/local/nginx/conf/conf.d
    /usr/local/nginx/conf/conf.d/test.domain.com.conf:  access_log /home/nginx/domains/test.domain.com/log/access.log  buffer=256k flush=60m;
    /usr/local/nginx/conf/conf.d/demodomain.com.conf:            access_log /home/nginx/domains/demodomain.com/log/access.log ;
    [14:21][root@srv3.domain.com centminmod]#  nano /usr/local/nginx/conf/conf.d/test.domain.com.ssl.conf



    Vhost
    Code (Text):
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html
    # For HTTP/2 SSL Setup
    # read http://centminmod.com/nginx_configure_https_ssl_spdy.html
    
    # redirect from www to non-www  forced SSL
    # uncomment, save file and restart Nginx to enable
    # if unsure use return 302 before using return 301
    #x# HTTPS-DEFAULT
    server {
    
      server_name test.domain.com www.test.domain.com;
      return 302 https://$server_name$request_uri;
    }
    
    server {
      listen 443 ssl http2;
      server_name test.domain.com www.test.domain.com;
    
      include /usr/local/nginx/conf/ssl/test.domain.com/test.domain.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 EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA256:EECDH+ECDSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA+SHA384:EECDH+AES128:!aNULL:!eNULL:!LOW:!3DES:!MD5$
      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;
    
    
      include /usr/local/nginx/conf/autoprotect/test.domain.com/autoprotect-test.domain.com.conf;
      root /home/nginx/domains/test.domain.com/public;
      access_log /var/log/nginx/test.domain.com.access.log combined buffer=8k flush=1m;
    
      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;
    }
    


    #Vhost is not complete.
     
  15. eva2000

    eva2000 Administrator Staff Member

    30,149
    6,782
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,133
    Local Time:
    11:25 PM
    Nginx 1.13.x
    MariaDB 5.5
    see you're missing log format from bug
    Code (Text):
    access_log /home/nginx/domains/test.domain.com/log/access.log  buffer=256k flush=60m;
    

    should be
    Code (Text):
    access_log /home/nginx/domains/test.domain.com/log/access.log combined buffer=256k flush=60m;
    

    did you create vhost with acmetool.sh HTTPS ? i just updated 123.09beta01 with a bug fix too
     
  16. ljseals

    ljseals Member

    88
    22
    8
    Dec 20, 2016
    Ratings:
    +43
    Local Time:
    8:25 AM
    From the acmetool.sh HTTPS option 4. I delete the log format to troubleshoot but it has not worked from a clean vhost install. Failed immediately after acmetool install.
     
  17. eva2000

    eva2000 Administrator Staff Member

    30,149
    6,782
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,133
    Local Time:
    11:25 PM
    Nginx 1.13.x
    MariaDB 5.5
    run centmin.sh menu option 23 submenu option 2 again for latest fixes I added then as per instructions on update text, it will ask you to exit centmin.sh menu via option 24 and change back into directory to re-run centmin.sh, you can never run centmin.sh within same session as your option 23 updates as updated files aren't registered with existing running centmin.sh instance
     
    • Like Like x 1