I have the following problem.
I'm using a nginx server. To serve my images correctly I've added following location rule:
location /images/ {
alias /srv/mysite/images/;
autoindex off;
}
Everything is ok. But if I add the the Browser Caching (found here)
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
expires 30d;
add_header Pragma public;
add_header Cache-Control "public";
}
No images are served
Can someone help please? Thanks.
EDIT
Here is the full configuration:
server {
#listen 80 is default
server_name www.mysite.com;
return 301 $scheme://mysite.com$request_uri;
}
server {
listen 80;
server_name mysite.com;
access_log /var/log/nginx/mysite.com.log;
error_log /var/log/nginx/mysite.com.err;
location / {
include uwsgi_params;
uwsgi_pass unix:///var/uwsgi/mysite.com.node1.sock;
}
location = /robots.txt {
alias /srv/mysite.com/robots.txt;
}
location /m/ {
alias /srv/mysite.com/node1/static/;
autoindex off;
expires max;
}
location /upfiles/ {
alias /srv/mysite.com/upfiles/;
autoindex off;
}
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
gzip_comp_level 6;
#gzip_comp_level 9;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
# gzip_http_version 1.1;
gzip_types text/plain application/xml text/css text/js text/xml application/x-javascript text/javascript application/json application/xml+rss;
####
##Browser Cache
####
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
expires 30d;
add_header Pragma public;
add_header Cache-Control "public";
}
}