Hello All,
I am migrating a site from apache web server and cannot get nginx header expiration work. This is the part of the server block (testing on a subdomain):
Nginx restarts OK, no error messages, but it doesn't change header expiration:
What could be wrong here and prevent setting expiration times?
Thanks!
I am migrating a site from apache web server and cannot get nginx header expiration work. This is the part of the server block (testing on a subdomain):
Code:
server {
listen 80 default_server;
server_name br.mydomain.com;
server_name www.br.mydomain.com;
server_name ipv4.br.mydomain.com;
server_name localhost;
# Path for static files
root /usr/share/nginx/html;
#Specify a charset
charset utf-8;
# Custom 404 page
error_page 404 /404.html;
# cache.appcache, your document html and data
location ~* \.(?:manifest|appcache|html|xml|json)$ {
expires -1;
# access_log logs/static.log;
}
# Feed
location ~* \.(?:rss|atom)$ {
expires 1h;
add_header Cache-Control "public";
}
# Favicon
location ~* \.ico$ {
expires 1w;
access_log off;
add_header Pragma public;
add_header Cache-Control "public";
}
# Media: images, video, audio, HTC, WebFonts
location ~* \.(?:jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|eot|mp4|ogg|ogv|webm)$ {
expires 1M;
access_log off;
add_header Pragma public;
add_header Cache-Control "public";
}
location ~* \.(js|css)$ {
expires 60d;
add_header Pragma public;
add_header Cache-Control "public";
}
# CSS and Javascript
#location ~* \.(?:css|js)$ {
# expires 1y;
# access_log off;
# add_header Cache-Control "public";
#}
# opt-in to the future
add_header "X-UA-Compatible" "IE=Edge,chrome=1";
}
Nginx restarts OK, no error messages, but it doesn't change header expiration:
Code:
Cache-Control:max-age=604800
Connection:keep-alive
Date:Wed, 27 Nov 2013 22:07:55 GMT
Expires:Wed, 04 Dec 2013 22:07:55 GMT
Last-Modified:Mon, 18 Nov 2013 08:34:10 GMT
Server:nginx
X-Powered-By:PleskLin
What could be wrong here and prevent setting expiration times?
Thanks!