Discover Centmin Mod today
Register Now

Nginx autoprotect nginx problem

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by adamus007p, Apr 11, 2020.

  1. adamus007p

    adamus007p Member

    283
    17
    18
    Feb 8, 2019
    Ratings:
    +29
    Local Time:
    7:28 PM
    Hello,

    I have my nginx config and I want to comment
    /usr/local/nginx/conf/autoprotect/domain.com the file autoprotect-lucid-samples.com.conf


    Code (Text):
    #location / {
    #  location ~ ^/(.+/)?(.+)\.(js)$ { allow all; expires 30d; }
    #  location ~ ^/(.+/)?(.+)\.(css)$ { allow all; expires 30d; }
    #  location ~ ^/(.+/)?(.+)\.(gif|jpe?g|png|webp|eot|svg|ttf|woff|woff)$ { allow all; expires 30d; }
    #  location ~ ^/(.+/)?(.+)\.(php|cgi|pl|php3|php4|php5|php6|phtml|shtml)$ { allow 127.0.0.1; deny all; }
    #}


    even when I comment it it will regenerate causing me problems:

    Code (Text):
    systemctl status nginx.service
    ? nginx.service - SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server
       Loaded: loaded (/etc/rc.d/init.d/nginx; bad; vendor preset: disabled)
       Active: failed (Result: exit-code) since Fri 2020-04-10 16:41:18 UTC; 7min ago
         Docs: man:systemd-sysv-generator(8)
      Process: 15769 ExecStart=/etc/rc.d/init.d/nginx start (code=exited, status=1/FAILURE)
     Main PID: 19464 (code=exited, status=0/SUCCESS)
    
    Apr 10 16:41:18 domains.com systemd[1]: Starting SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server...
    Apr 10 16:41:18 domains.com nginx[15769]: Starting nginx: nginx: [emerg] duplicate location "/" in /usr/local/nginx/conf/mycustomconfig.conf:61
    Apr 10 16:41:18 domains.com nginx[15769]: [FAILED]
    Apr 10 16:41:18 domains.com systemd[1]: nginx.service: control process exited, code=exited status=1
    Apr 10 16:41:18 domains.com systemd[1]: Failed to start SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server.
    Apr 10 16:41:18 domains.com systemd[1]: Unit nginx.service entered failed state.
    Apr 10 16:41:18 domains.com systemd[1]: nginx.service failed.
    



    How can I fix it permanently?



    This lines I want to comment permanently and use my own nginx config like in this post: CDN - WebPerf - Webp - how to use?
    Code (Text):
    #location / {
    #  location ~ ^/(.+/)?(.+)\.(js)$ { allow all; expires 30d; }
    #  location ~ ^/(.+/)?(.+)\.(css)$ { allow all; expires 30d; }
    #  location ~ ^/(.+/)?(.+)\.(gif|jpe?g|png|webp|eot|svg|ttf|woff|woff)$ { allow all; expires 30d; }
    #  location ~ ^/(.+/)?(.+)\.(php|cgi|pl|php3|php4|php5|php6|phtml|shtml)$ { allow 127.0.0.1; deny all; }
    #}



    How to fix this problem permanently?
     
    Last edited: Apr 11, 2020
  2. pamamolf

    pamamolf Premium Member Premium Member

    3,991
    416
    83
    May 31, 2014
    Ratings:
    +806
    Local Time:
    8:28 PM
    Nginx-1.17.x
    MariaDB 10.3.x
    They auto generated by this cronjob:

    Code:
    13 23 * * * /usr/local/src/centminmod/tools/autoprotect.sh >/dev/null 2>&1
    So you may need to edit it by using crontab -e and just add a comment in front of it #
     
  3. adamus007p

    adamus007p Member

    283
    17
    18
    Feb 8, 2019
    Ratings:
    +29
    Local Time:
    7:28 PM
    Thank you for a solution. I have add #. Do I need to restart anything to make it "online" ?


    Is there any other that I can keep comment only for this
    Code (Text):
    #location / {
    #  location ~ ^/(.+/)?(.+)\.(js)$ { allow all; expires 30d; }
    #  location ~ ^/(.+/)?(.+)\.(css)$ { allow all; expires 30d; }
    #  location ~ ^/(.+/)?(.+)\.(gif|jpe?g|png|webp|eot|svg|ttf|woff|woff)$ { allow all; expires 30d; }
    #  location ~ ^/(.+/)?(.+)\.(php|cgi|pl|php3|php4|php5|php6|phtml|shtml)$ { allow 127.0.0.1; deny all; }
    #}

    and not remove a cron?

    What is it basically for the autoprotect config?

    @eva2000 may you help? :)