Want more timely Centmin Mod News Updates?
Become a Member

Wordpress Adding a wordpress vhost breaks nginx

Discussion in 'Blogs & CMS usage' started by jair, Dec 6, 2017.

  1. jair

    jair New Member

    21
    1
    3
    Jan 8, 2017
    Ratings:
    +2
    Local Time:
    10:44 AM
    I am trying to add a wordpress vhost via option 22 in centminmod menu. Everything looks ok, up to a point where nginx has to be restarted and it fails there.

    I read in other topics here that I need to run nginx -t and here it is:

    Code:
     nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
    nginx: [emerg] zero size shared memory zone "xwplogin"
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
    When I remove the newly created vhost files, nginx starts correctly. Here is the content of the two vhosts generated by the script, I haven't added anything custom to them.

    Code:
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html
    
    # redirect from non-www to www
    # uncomment, save file and restart Nginx to enable
    # if unsure use return 302 before using return 301
    #server {
    #            listen   80;
    #            server_name shop.magelanci.com www.shop.magelanci.com;
    #            return 301 $scheme://www.shop.magelanci.com$request_uri;
    #       }
    
    server {
    
      server_name shop.magelanci.com www.shop.magelanci.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;
    
      #add_header X-Frame-Options SAMEORIGIN;
      #add_header X-Xss-Protection "1; mode=block" always;
      #add_header X-Content-Type-Options "nosniff" always;
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/shop.magelanci.com/log/access.log combined buffer=256k flush=5m;
      error_log /home/nginx/domains/shop.magelanci.com/log/error.log;
    
      include /usr/local/nginx/conf/autoprotect/shop.magelanci.com/autoprotect-shop.magelanci.com.conf;
      root /home/nginx/domains/shop.magelanci.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;
    
      include /usr/local/nginx/conf/wpincludes/shop.magelanci.com/wpcacheenabler_shop.magelanci.com.conf;
      #include /usr/local/nginx/conf/wpincludes/shop.magelanci.com/wpsupercache_shop.magelanci.com.conf;
      # https://community.centminmod.com/posts/18828/
      #include /usr/local/nginx/conf/wpincludes/shop.magelanci.com/rediscache_shop.magelanci.com.conf;
    
      location / {
      include /usr/local/nginx/conf/503include-only.conf;
    
    
      # Enables directory listings when index file not found
      #autoindex  on;
    
      # for wordpress super cache plugin
      #try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php?q=$uri&$args;
    
      # for wp cache enabler plugin
      try_files $cache_enabler_uri $uri $uri/ $custom_subdir/index.php?$args;
    
      # Wordpress Permalinks
      #try_files $uri $uri/ /index.php?q=$uri&$args;
    
      # Nginx level redis Wordpress
      # https://community.centminmod.com/posts/18828/
      #try_files $uri $uri/ /index.php?$args;
    
      }
    
    location ~* /(wp-login\.php) {
        limit_req zone=xwplogin burst=1 nodelay;
        #limit_conn xwpconlimit 30;
        auth_basic "Private";
        auth_basic_user_file /home/nginx/domains/shop.magelanci.com/htpasswd_wplogin;
        include /usr/local/nginx/conf/php-wpsc.conf;
        # https://community.centminmod.com/posts/18828/
        #include /usr/local/nginx/conf/php-rediscache.conf;
    }
    
    location ~* /(xmlrpc\.php) {
        limit_req zone=xwprpc burst=45 nodelay;
        #limit_conn xwpconlimit 30;
        include /usr/local/nginx/conf/php-wpsc.conf;
        # https://community.centminmod.com/posts/18828/
        #include /usr/local/nginx/conf/php-rediscache.conf;
    }
    
      include /usr/local/nginx/conf/wpincludes/shop.magelanci.com/wpsecure_shop.magelanci.com.conf;
      include /usr/local/nginx/conf/php-wpsc.conf;
    
      # https://community.centminmod.com/posts/18828/
      #include /usr/local/nginx/conf/php-rediscache.conf;
      include /usr/local/nginx/conf/pre-staticfiles-local-shop.magelanci.com.conf;
      include /usr/local/nginx/conf/pre-staticfiles-global.conf;
      include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
      include /usr/local/nginx/conf/vts_server.conf;
    
    }

    Code:
    # 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
    # server {
    #   server_name shop.magelanci.com www.shop.magelanci.com;
    #    return 302 https://$server_name$request_uri;
    # }
    
    server {
      listen 443 ssl http2;
      server_name shop.magelanci.com www.shop.magelanci.com;
    
      ssl_dhparam /usr/local/nginx/conf/ssl/shop.magelanci.com/dhparam.pem;
      ssl_certificate      /usr/local/nginx/conf/ssl/shop.magelanci.com/shop.magelanci.com.crt;
      ssl_certificate_key  /usr/local/nginx/conf/ssl/shop.magelanci.com/shop.magelanci.com.key;
      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;
      #ssl_trusted_certificate /usr/local/nginx/conf/ssl/shop.magelanci.com/shop.magelanci.com-trusted.crt;
    
    # 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;
    
      #add_header X-Frame-Options SAMEORIGIN;
      #add_header X-Xss-Protection "1; mode=block" always;
      #add_header X-Content-Type-Options "nosniff" always;
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/shop.magelanci.com/log/access.log combined buffer=256k flush=5m;
      error_log /home/nginx/domains/shop.magelanci.com/log/error.log;
    
      include /usr/local/nginx/conf/autoprotect/shop.magelanci.com/autoprotect-shop.magelanci.com.conf;
      root /home/nginx/domains/shop.magelanci.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;
    
      include /usr/local/nginx/conf/wpincludes/shop.magelanci.com/wpcacheenabler_shop.magelanci.com.conf;
      #include /usr/local/nginx/conf/wpincludes/shop.magelanci.com/wpsupercache_shop.magelanci.com.conf;
      # https://community.centminmod.com/posts/18828/
      #include /usr/local/nginx/conf/wpincludes/shop.magelanci.com/rediscache_shop.magelanci.com.conf;
    
      location / {
      include /usr/local/nginx/conf/503include-only.conf;
    
    
      # Enables directory listings when index file not found
      #autoindex  on;
    
      # for wordpress super cache plugin
      #try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php?q=$uri&$args;
    
      # for wp cache enabler plugin
      try_files $cache_enabler_uri $uri $uri/ $custom_subdir/index.php?$args;
    
      # Wordpress Permalinks
      #try_files $uri $uri/ /index.php?q=$uri&$args;
    
      # Nginx level redis Wordpress
      # https://community.centminmod.com/posts/18828/
      #try_files $uri $uri/ /index.php?$args;
    
      }
    
    location ~* /(wp-login\.php) {
        limit_req zone=xwplogin burst=1 nodelay;
        #limit_conn xwpconlimit 30;
        auth_basic "Private";
        auth_basic_user_file /home/nginx/domains/shop.magelanci.com/htpasswd_wplogin;
        include /usr/local/nginx/conf/php-wpsc.conf;
    
        # https://community.centminmod.com/posts/18828/
        #include /usr/local/nginx/conf/php-rediscache.conf;
    }
    
    location ~* /(xmlrpc\.php) {
        limit_req zone=xwprpc burst=45 nodelay;
        #limit_conn xwpconlimit 30;
        include /usr/local/nginx/conf/php-wpsc.conf;
    
        # https://community.centminmod.com/posts/18828/
        #include /usr/local/nginx/conf/php-rediscache.conf;
    }
    
      include /usr/local/nginx/conf/wpincludes/shop.magelanci.com/wpsecure_shop.magelanci.com.conf;
      include /usr/local/nginx/conf/php-wpsc.conf;
    
      # https://community.centminmod.com/posts/18828/
      #include /usr/local/nginx/conf/php-rediscache.conf;
      include /usr/local/nginx/conf/pre-staticfiles-local-shop.magelanci.com.conf;
      include /usr/local/nginx/conf/pre-staticfiles-global.conf;
      include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
      include /usr/local/nginx/conf/vts_server.conf;
    }
    
    I suppose it is the wp-login protection, which I don't want to disable. Centminmod is almost the latest beta with almost all updates (last updated in the weekend).

    Some help will be appreciated!
     
  2. jair

    jair New Member

    21
    1
    3
    Jan 8, 2017
    Ratings:
    +2
    Local Time:
    10:44 AM
    Commenting out this line:

    Code:
    limit_req zone=xwplogin burst=1 nodelay;
    worked and now nginx starts without issue. On another vps I don't have such problems...
     
  3. eva2000

    eva2000 Administrator Staff Member

    37,305
    8,151
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,547
    Local Time:
    6:44 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
  4. jair

    jair New Member

    21
    1
    3
    Jan 8, 2017
    Ratings:
    +2
    Local Time:
    10:44 AM
    Yes, that was it! It wasn't me, but one guy that was supposed to "optimize" my server. Thank you and enjoy your time away :)
     
    • Informative Informative x 1
  5. Jon Snow

    Jon Snow Active Member

    387
    61
    28
    Jun 30, 2017
    Ratings:
    +92
    Local Time:
    4:44 AM
    Nginx 1.13.9
    MariaDB 10.1.31
    But CMM is optimized for the server out of the box. It's scripts you need to tweak stuff for.
     
    • Agree Agree x 1
  6. eva2000

    eva2000 Administrator Staff Member

    37,305
    8,151
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,547
    Local Time:
    6:44 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    Ah ha, yes Centmin Mod is auto optimised out of the box for the server specs. Though further optimisation is possibly required for your web app's usage requirements.
     
..