I made some optimizations using gtmetrix to improve web site performance. Like enabling gzip compression etc..
When I try to test site using online services like browserling.com images are not dislayed.
When I try to connect from server. Like 192.168.1.xx it works fine.
Related part of /etc/nginx/nginx.conf is like that :
##
# Gzip Settings
##
gzip on;
gzip_vary on;
gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
And in /etc/nginx/sites-enabled/programlama.tk I added this part.
location ~* \.(jpg|jpeg|png|gif|ico)$ {
expires 365d;
}
location ~* \.(css|js)$ {
expires 30d;
}
location ~* \.(pdf)$ {
expires 30d;
}
Update :
I suspect the problem is in server block in location expires part.
server {
server_name programlama.tk;
location /static {
limit_except GET HEAD POST {
deny all;
}
include yasaklananlar.conf;
# alias
}
location / {
limit_except GET HEAD POST {
deny all;
}
include yasaklananlar.conf;
include proxy_params;
# proxy_pass
}
location ~* \.(jpg|jpeg|png|gif|ico)$ {
expires 365d;
}
location ~* \.(css|js)$ {
expires 30d;
}
location ~* \.(pdf)$ {
expires 30d;
}
# server settings
}
If I remove location expires part in server block and restart Nginx server it displays images fine.