Answer the question
In order to leave comments, you need to log in
Nginx caches hard | How to disable HTML caching?
Hello.
Got rid of Apache, switched to Nginx + php-fpm. Passed without major problems! But noticed strong caching. For example, you click on "Exit" (from the site's account), and the page remains for an authorized user, but in fact he is no longer authorized.
In the ISP panel, I set up caching for 7 days (if you remove it, then there is no problem), I can’t find in the configs where it is written in order to correct the code ...
Tell me how you can bypass hard caching so that if you log out, the page is appropriate ?
Thank you.
server {
server_name danfa.net www.danfa.net;
charset UTF-8;
index index.php;
disable_symlinks if_not_owner from=$root_path;
include /etc/nginx/vhosts-includes/*.conf;
include /etc/nginx/vhosts-resources/danfa.net/*.conf;
error_log /var/www/httpd-logs/danfa.net.error.log notice;
ssi on;
return 301 https://$host:443$request_uri;
set $root_path /var/www/www-root/data/www/danfa.net;
root $root_path;
gzip on;
gzip_comp_level 5;
gzip_disable "msie6";
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
location / {
try_files $uri /index.php?do=$uri;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
}
access_log off;
expires 7d;
listen xxxxxxxxxxxxxxxxxxxxx;
listen xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
}
server {
server_name danfa.net www.danfa.net;
ssl on;
ssl_certificate "/var/www/httpd-cert/www-root/danfa.net_le1.crtca";
ssl_certificate_key "/var/www/httpd-cert/www-root/danfa.net_le1.key";
ssl_ciphers EECDH:+AES256:-3DES:RSA+AES:!NULL:!RC4;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
add_header Strict-Transport-Security "max-age=31536000;";
ssl_dhparam /etc/ssl/certs/dhparam4096.pem;
charset UTF-8;
index index.php;
disable_symlinks if_not_owner from=$root_path;
include /etc/nginx/vhosts-includes/*.conf;
include /etc/nginx/vhosts-resources/danfa.net/*.conf;
error_log /var/www/httpd-logs/danfa.net.error.log notice;
ssi on;
set $root_path /var/www/www-root/data/www/danfa.net;
root $root_path;
listen xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
listen xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
gzip on;
gzip_comp_level 5;
gzip_disable "msie6";
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
location / {
try_files $uri /index.php?do=$uri;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
}
access_log off;
expires 7d;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question