Решил на сайте настроить нормально браузерное кеширование, с помощью PHP генерирую заголовки нужные Last-Modified и ETag. На локальной машине все отлично nginx передает в браузер, а как заливаю на сервер nginx перестает передавать эти заголовки. Может кто шарит в конфиг файле Nginx подскажет что возможно сдела не такКод:user www-data; #worker_processes 1; worker_processes auto; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { use epoll; worker_connections 1024; multi_accept on; } 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; sendfile on; keepalive_timeout 65; include /etc/nginx/conf.d/*.conf; include /etc/nginx/vhosts/*/*.conf; client_max_body_size 128m; server { server_name localhost; disable_symlinks if_not_owner; include /etc/nginx/vhosts-includes/*.conf; location @fallback { error_log /dev/null crit; proxy_pass http://127.0.0.1:8080; proxy_redirect http://127.0.0.1:8080 /; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; access_log off ; } listen 80; } } server { server_name site.ru www.site.ru; charset UTF-8; disable_symlinks if_not_owner from=$root_path; index index.php; root $root_path; set $root_path /var/www/site/data/www/site.ru/public; access_log off ; error_log /var/www/httpd-logs/site.ru.error.log notice; include /etc/nginx/vhosts-includes/*.conf; location / { if ($http_host !~ "^site.ru"){ return 301 $scheme://site.ru$request_uri; } try_files $uri $uri/ /index.php?_url=$uri&$args; location ~ [^/]\.ph(p\d*|tml)$ { try_files /does_not_exists @php; } } location @php { fastcgi_index index.php; fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f webmaster@site.ru"; fastcgi_pass unix:/var/run/php/php7.1-fpm.sock; fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$; try_files $uri =404; include fastcgi_params; } location @fallback { } location ~* ^.+\.(rss|atom|jpg|jpeg|gif|png|ico|rtf|js|css)$ { expires 7d; etag on; } ssi on; gzip on; gzip_comp_level 9; 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; etag on; add_header Strict-Transport-Security "max-age=31536000;"; listen 138.201.75.11:443; ssl on; ssl_certificate "/var/www/httpd-cert/avia/site.ru_le1.crtca"; ssl_certificate_key "/var/www/httpd-cert/avia/site.ru_le1.key"; ssl_ciphers EECDH:+AES256:-3DES:RSA+AES:RSA+3DES:!NULL:!RC4:!RSA+3DES; ssl_dhparam /etc/ssl/certs/dhparam4096.pem; ssl_prefer_server_ciphers on; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; }
- 29.10.2017 21:54
- Регистрация: 08.08.2013
- Сообщений: 19
- Репутация: 3
- 09.05.2018 01:17
Fubu_By, используйте параметр в директории PHP.
Код:user www-data; #worker_processes 1; worker_processes auto; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { use epoll; worker_connections 1024; multi_accept on; } 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; sendfile on; keepalive_timeout 65; include /etc/nginx/conf.d/*.conf; include /etc/nginx/vhosts/*/*.conf; client_max_body_size 128m; server { server_name localhost; disable_symlinks if_not_owner; include /etc/nginx/vhosts-includes/*.conf; location @fallback { error_log /dev/null crit; proxy_pass http://127.0.0.1:8080; proxy_redirect http://127.0.0.1:8080 /; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; access_log off ; } listen 80; } } server { server_name site.ru www.site.ru; charset UTF-8; disable_symlinks if_not_owner from=$root_path; index index.php; root $root_path; set $root_path /var/www/site/data/www/site.ru/public; access_log off ; error_log /var/www/httpd-logs/site.ru.error.log notice; include /etc/nginx/vhosts-includes/*.conf; location / { if ($http_host !~ "^site.ru"){ return 301 $scheme://site.ru$request_uri; } try_files $uri $uri/ /index.php?_url=$uri&$args; location ~ [^/]\.ph(p\d*|tml)$ { try_files /does_not_exists @php; } } location @php { fastcgi_index index.php; fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f webmaster@site.ru"; fastcgi_pass unix:/var/run/php/php7.1-fpm.sock; fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$; etag on; add_header Strict-Transport-Security "max-age=31536000;"; try_files $uri =404; include fastcgi_params; } location @fallback { } location ~* ^.+\.(rss|atom|jpg|jpeg|gif|png|ico|rtf|js|css)$ { expires 7d; etag on; } ssi on; gzip on; gzip_comp_level 9; 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; listen 138.201.75.11:443; ssl on; ssl_certificate "/var/www/httpd-cert/avia/site.ru_le1.crtca"; ssl_certificate_key "/var/www/httpd-cert/avia/site.ru_le1.key"; ssl_ciphers EECDH:+AES256:-3DES:RSA+AES:RSA+3DES:!NULL:!RC4:!RSA+3DES; ssl_dhparam /etc/ssl/certs/dhparam4096.pem; ssl_prefer_server_ciphers on; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; }
Тэги топика:
- application,
- conf,
- etag,
- include,
- last-modified,
- location,
- nginx,
- site,
- передать
Похожие темы
Темы | Раздел | Ответов | Последний пост |
---|---|---|---|
Last-modified - стоит ли использовать? | Общие вопросы поисковой оптимизации | 8 | 25.04.2015 02:22 |
Как правильно настроить ответ сервера 304 Not modified на запрос клиента if-modified-since? | Web программирование | 1 | 15.09.2014 10:44 |
Стоит ли использовать HTTP заголовки If-Modified-Since ? | Общие вопросы поисковой оптимизации | 0 | 28.07.2014 13:45 |
Запрос If-Modified-Since | Web программирование | 1 | 10.02.2012 05:01 |
Запрос If-Modified-Since | Вопросы от новичков | 0 | 09.02.2012 02:42 |