I just can't figure out how to enable caching in nginx + apache for the browser.
I've already downloaded all the options that I found in Google, but for some reason, caching is not included.
Never worked with nginx, a little better with Apache.
The site inherited, works on opencarte.
Server response header
HTTP/1.1 200 OK Server: nginx/0.8.54 Date: Fri, 17 Jun 2016 04:59:35 GMT Content-Type: text/html; charset=utf-8 Connection: keep-alive X-Powered-By: PHP/5.3.3 Set-Cookie: PHPSESSID=dgaoi1d84popfej16f5b8go8e5; expires=Sun, 17-Jul-2016 04:59:33 GMT; path=/ Expires: Fri, 17 Jun 2016 04:59:33 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Set-Cookie: language=ru; expires=Sun, 17-Jul-2016 04:59:33 GMT; path=/; domain=mysite.ru Set-Cookie: currency=RUB; expires=Sun, 17-Jul-2016 04:59:33 GMT; path=/; domain=mysite.ru Last-Modified: Fri, 17 Jun 2016 04:39:33 GMT Nginx config
####################################################################### # # This is the main Nginx configuration file. # # More information about the configuration options is available on # * the English wiki - http://wiki.nginx.org/Main # * the Russian documentation - http://sysoev.ru/nginx/ # ####################################################################### #---------------------------------------------------------------------- # Main Module - directives that cover basic functionality # # http://wiki.nginx.org/NginxHttpMainModule # #---------------------------------------------------------------------- user nginx; worker_processes 1; error_log /var/log/nginx/error.log; #error_log /var/log/nginx/error.log notice; #error_log /var/log/nginx/error.log info; pid /var/run/nginx.pid; #---------------------------------------------------------------------- # Events Module # # http://wiki.nginx.org/NginxHttpEventsModule # #---------------------------------------------------------------------- events { worker_connections 1024; } #---------------------------------------------------------------------- # HTTP Core Module # # http://wiki.nginx.org/NginxHttpCoreModule # #---------------------------------------------------------------------- http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; server_names_hash_bucket_size 1024; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; # # The default server # # Load config files from the /etc/nginx/conf.d directory include /etc/nginx/conf.d/*.conf; client_max_body_size 16m; log_format isp '$bytes_sent $request_length'; server { listen 10.12.10.141:80; server_name mysite.ru *.mysite.ru www.mysite.ru; rewrite ^(/manager/.*)$ https://$host$1 permanent; error_page 404 = @fallback; location ~* ^/(webstat/|awstats|webmail/|myadmin/|manimg/) { proxy_pass http://10.12.10.141:8080; proxy_redirect http://mysite.ru:8080/ /; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; } location / { proxy_pass http://10.12.10.141:8080; proxy_redirect http://mysite.ru:8080/ /; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; } location ~* ^.+\.(js|css|jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar)$ { access_log /var/www/httpd-logs/mysite.ru.access.log ; access_log /var/www/nginx-logs/mysite.ru isp; set $proot "/var/www/mysite.ru/data/www/mysite.ru"; expires 24h; if ( $host = "mysite.ru" ) { break; } if ( $host = "www.mysite.ru" ) { break; } if ( $host ~* ^(.*).mysite.ru$ ) { set $proot /var/www/mysite.ru/data/www/mysite.ru/$1; break; } root $proot; } location @fallback { proxy_pass http://10.12.10.141:8080; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; } } } .htacces apache
# 1.To use URL Alias you need to be running apache with mod_rewrite enabled. # 2. In your opencart directory rename htaccess.txt to .htaccess. # For any support issues please visit: http://www.opencart.com Options +FollowSymLinks # Prevent Directoy listing Options -Indexes # Prevent Direct Access to files Deny from 10.10.12.10 #<FilesMatch "\.(js|css|png|jpg|jpeg|bmp|gif)$"> # Header set Cache-Control "max-age=604800, must-revalidate" #</FilesMatch> <FilesMatch "\.(tpl|ini|log)"> Order deny,allow Deny from all </FilesMatch> # SEO URL Settings RewriteEngine On # If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/ RewriteBase / #Создание ссылок ЧПУ ###RewriteRule ^$1/$2/$3 /index.php?route=$1/$4&path=$2&product_id=$3 [L,QSA] RewriteRule ^sitemap.html$ index.php?route=information/sitemap [L,QSA] #RewriteRule ^catalog\.html /index.php?route=product/category [L,QSA] #RewriteRule ^news\.html(.*) /index.php?route=information/news$1 [L,QSA] #RewriteRule ^works\.html(.*) /index.php?route=information/works$1 [L,QSA] #RewriteRule ^articles\.html(.*) /index.php?route=information/articles$1 [L,QSA] #RewriteRule ^reviews/(.*)\.html /index.php?route=information/reviews&rreview_id=$1 [L,QSA] #RewriteRule ^reviews\.html(.*) /index.php?route=information/reviews$1 [L,QSA] RewriteRule ^information/([^?]*) index.php?route=information/$1 [L,QSA] RewriteRule ^product/([^?]*) index.php?route=product/$1 [L,QSA] RewriteRule ^cache_([^?]*) cache.php?f=$1 [L,QSA] #RewriteRule ^news/([^?]*) /index.php?route=information/news/$1 [L,QSA] RewriteCond %{HTTP_HOST} ^www\.mysite\.ru$ [NC] RewriteCond %{REQUEST_URI} !^/robots.* RewriteRule ^(.*)$ http://mysite.ru/$1 [R=301,L] ##RewriteCond %{REQUEST_FILENAME} !-d ##RewriteCond %{REQUEST_URI} ^(.+)/$ ##RewriteRule ^(.+)/$ /$1 [R=301,L] RewriteRule /eksklyuzivnaya-vinnaya-kollekciya/ http://mysite.ru/vino/eksklyuzivnaya-vinnaya-kollektsiya/ [R=301,L] RewriteRule /Vieil_Armagnac_Sempe_1948_Sempyе_V_ei_Arman_jаk-v_podar_up/ http://mysite.ru/krepkie-napitki/armanyak/vieil-armagnac-sempe-1948-sempe-vej-armanyak-v-podarup/ [R=301,L] #Redirect 301 /Dopff_au_Moulin_Dopf_o_Mulen/ http://mysite.ru/dopff-au-moulindopf-o-mulen/ RewriteCond %{THE_REQUEST} ^[AZ]{3,9}\ /index\.php\ HTTP RewriteRule ^index\.php$ http://mysite.ru/ [R=301,L] RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L,QSA] RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L] RewriteRule ^yandexmarket.xml$ index.php?route=feed/yandex_market [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA] ### Additional Settings that may need to be enabled for some servers ### Uncomment the commands by removing the # sign in front of it. ### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that. # 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it: # php_flag register_globals off # 2. If your cart has magic quotes enabled, This may work to disable it: # php_flag magic_quotes_gpc Off # 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try # php_value upload_max_filesize 999M # 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields # php_value post_max_size 999M # 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields # php_value max_execution_time 200 # 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields # php_value max_input_time 200 php_value max_input_vars 10000
content-typeheader, this response is most likely formed by php- scripts. most likely, headers that affect caching on the client side (expires,cache-control,last-modified) are formed by them. - aleksandr barakin