Learn about Centmin Mod LEMP Stack today
Become a Member

Disable nginx and php caching

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by pamamolf, Sep 28, 2016.

  1. pamamolf

    pamamolf Premium Member Premium Member

    4,087
    428
    83
    May 31, 2014
    Ratings:
    +834
    Local Time:
    8:53 AM
    Nginx-1.25.x
    MariaDB 10.3.x
    Hi :)

    How can i disable all caching methods just for some dev tests?


    nginx cache and php zend opcache plus memcache .... ?

    Thank you
     
  2. eva2000

    eva2000 Administrator Staff Member

    54,946
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,812
    Local Time:
    4:53 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    comment out staticfiles.conf include file in nginx vhost and comment out zend opcache zend_extension=opcache.so load line in zendopcache.ini file path found from command
    Code (Text):
    php --ini

    then restart nginx and php
    Code (Text):
    nprestart

    memcached isn't used unless you web app is configured to use it
     
  3. pamamolf

    pamamolf Premium Member Premium Member

    4,087
    428
    83
    May 31, 2014
    Ratings:
    +834
    Local Time:
    8:53 AM
    Nginx-1.25.x
    MariaDB 10.3.x
    Is there any global setting for this or i should do it on every vhost file?

    staticfiles.conf
     
  4. eva2000

    eva2000 Administrator Staff Member

    54,946
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,812
    Local Time:
    4:53 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    no global setting, if it's dev server, just move staticfiles.conf to a renamed file and setup an empty staticfiles.conf in it place - include file would do nothing then
     
  5. pamamolf

    pamamolf Premium Member Premium Member

    4,087
    428
    83
    May 31, 2014
    Ratings:
    +834
    Local Time:
    8:53 AM
    Nginx-1.25.x
    MariaDB 10.3.x
    User enable the Wordpress log in file but he can't get any errors there but it has some 500 errors on Chrome inspect for a specific php file...

    Or i should look on another file for that errors?
     
  6. eva2000

    eva2000 Administrator Staff Member

    54,946
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,812
    Local Time:
    4:53 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  7. pamamolf

    pamamolf Premium Member Premium Member

    4,087
    428
    83
    May 31, 2014
    Ratings:
    +834
    Local Time:
    8:53 AM
    Nginx-1.25.x
    MariaDB 10.3.x
    As the ftp user can see only the domain logs at :

    Code:
    /home/nginx/domains/domain.com/log/error.log
    Is it possible to split the /var/log/php-fpm/www-php.error.log per domain and get that errors also with simple ftp access?

    That will be good for developers ...
     
  8. eva2000

    eva2000 Administrator Staff Member

    54,946
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,812
    Local Time:
    4:53 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    nah you'd need root user access to get to read the logs right now as centmin mod isn't made for shared hosting (FAQ item 2)
     
  9. pamamolf

    pamamolf Premium Member Premium Member

    4,087
    428
    83
    May 31, 2014
    Ratings:
    +834
    Local Time:
    8:53 AM
    Nginx-1.25.x
    MariaDB 10.3.x
    It is very easy to go above and read that file with the ftp solution on Centminmod :(

    But i don't want to let them know that :(
     
  10. eva2000

    eva2000 Administrator Staff Member

    54,946
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,812
    Local Time:
    4:53 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    that's why Centmin Mod isn't for shared hosting :)

    It's for hosting your own sites and/or sites/users who you 100% trust.
     
  11. pamamolf

    pamamolf Premium Member Premium Member

    4,087
    428
    83
    May 31, 2014
    Ratings:
    +834
    Local Time:
    8:53 AM
    Nginx-1.25.x
    MariaDB 10.3.x
    Can i just change the log path from:

    Code:
    /home/nginx/domains/domain.com/log/
    to

    Code:
    php_admin_value[error_log] = /home/nginx/domains/domain.com/log/www-php.error.log
    And then revert it back when needed?
     
  12. eva2000

    eva2000 Administrator Staff Member

    54,946
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,812
    Local Time:
    4:53 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    you mean change /var/log/php-fpm/www-php.error.log to /home/nginx/domains/domain.com/log/ ? i wouldn't recommend changing paths just make a copy to the directory but it is server wide and not just domain.com related so if you don't want users reading other sites not ideal
     
  13. pamamolf

    pamamolf Premium Member Premium Member

    4,087
    428
    83
    May 31, 2014
    Ratings:
    +834
    Local Time:
    8:53 AM
    Nginx-1.25.x
    MariaDB 10.3.x
    Ok great...

    Is there any way to adjust ftp account in the way that is not possible to go outside of the domain folder like / ?
     
  14. eva2000

    eva2000 Administrator Staff Member

    54,946
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,812
    Local Time:
    4:53 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    pure-ftpd virtual ftp users are locked into /home/nginx/domains/domain.com and subdirectories under it. You want to block /home/nginx/domains/domain.com/log access ? if so just edit nginx vhost for domain and change the directory path to where access.log and error.logs belong i.e. /home/nginx/domains/log/domain.com/access.log etc
     
  15. pamamolf

    pamamolf Premium Member Premium Member

    4,087
    428
    83
    May 31, 2014
    Ratings:
    +834
    Local Time:
    8:53 AM
    Nginx-1.25.x
    MariaDB 10.3.x
    My issue is that with a simple upload of a php file the user can go to / :(

    The user can upload a web shell php file on public folder and then browse to it from browser and then he can go to / :(

    So the user is not so locked ....
     
    Last edited: Sep 28, 2016
  16. eva2000

    eva2000 Administrator Staff Member

    54,946
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,812
    Local Time:
    4:53 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  17. pamamolf

    pamamolf Premium Member Premium Member

    4,087
    428
    83
    May 31, 2014
    Ratings:
    +834
    Local Time:
    8:53 AM
    Nginx-1.25.x
    MariaDB 10.3.x
    Yes i know :)

    But i was thinking that Pure ftpd had something to block that by default....
     
  18. eva2000

    eva2000 Administrator Staff Member

    54,946
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,812
    Local Time:
    4:53 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    nope it doesn't
     
  19. Jon Snow

    Jon Snow Active Member

    842
    171
    43
    Jun 30, 2017
    Ratings:
    +258
    Local Time:
    3:53 AM
    Nginx 1.13.9
    MariaDB 10.1.31
    @eva2000 I've uncommented the 3 static file configs for the nginx vhost and I've recompiled php without zend opcache then I ran nprestart. The cache control still caches wordpress' CSS file.

    Am I doing anything wrong?

    Code (Text):
       location ~* \.(css)$ {
      #add_header Pragma public;
      #add_header X-Frame-Options SAMEORIGIN;
      #add_header X-Xss-Protection "1; mode=block" always;
      #add_header X-Content-Type-Options "nosniff" always;
      add_header Access-Control-Allow-Origin *;
      add_header Cache-Control "public, must-revalidate, proxy-revalidate, immutable, stale-while-revalidate=86400, stale-if-error=604800";
        access_log off;
        expires 30d;
        break;

    How do I make changes instant and never cache without using Cloudflare?
     
  20. Jon Snow

    Jon Snow Active Member

    842
    171
    43
    Jun 30, 2017
    Ratings:
    +258
    Local Time:
    3:53 AM
    Nginx 1.13.9
    MariaDB 10.1.31
    Anyone else have this issue?