@rahul286
Thank you for your excellent blog. I have read it before and it was helpful getting nginx working so far. I was reading five other tutorials before I had found yours, and they all failed on me. ?? I am not sure if editing the vhost manually is really necessary where W3C does exactly that for you. Please carry on reading and I explain it later.
@andreiguru
Thank you for the help. I am in fact using PHP-FPM ??
This my setting:
location ~ \.php$ {
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
Regarding editing manually the vhost, I am not sure if that is necessary. Please continue reading the post.
Today I tested the analysis again and it jumped up to 76 points.
The “Enable Compression” is completely gone.
“Leverage browser caching” is now yellow instead of red.
It says now:
The following cacheable resources have a short freshness lifetime. Specify an expiration at least one week in the future for the following resources:
Correct me if I am wrong, it seems the header expiry are set but are a bit fresh. So in a week’s time, this should become “old” enough and hence score higher?
Now to your setting suggestions. I think the only manual step is to include the nginx.conf that W3C is creating for you in the vhost.
include /var/www/example/htdocs/nginx.conf;
It seems W3C has already generated all settings in there that you have both suggested in the external conf file:
# BEGIN W3TC Browser Cache
gzip on;
gzip_types text/css application/x-javascript text/x-component text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
location ~ \.(css|js|htc)$ {
expires 31536000s;
add_header Pragma "public";
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
add_header X-Powered-By "W3 Total Cache/0.9.2.4";
}
location ~ \.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml)$ {
expires 3600s;
add_header Pragma "public";
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
add_header X-Powered-By "W3 Total Cache/0.9.2.4";
}
location ~ \.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$ {
expires 31536000s;
add_header Pragma "public";
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
add_header X-Powered-By "W3 Total Cache/0.9.2.4";
}
# END W3TC Browser Cache
# BEGIN W3TC Minify core
rewrite ^/wp-content/w3tc/min/w3tc_rewrite_test$ /wp-content/w3tc/min/index.php?w3tc_rewrite_test=1 last;
rewrite ^/wp-content/w3tc/min/(.+\.(css|js))$ /wp-content/w3tc/min/index.php?file=$1 last;
# END W3TC Minify core
Do you think it is missing anything there? Because I think its best to drive the settings from one place. Otherwise the manual settings could get in the way of W3C settings. Don’t you think?
So I have a few question for you gurus ??
1) How do I combine images into CSS sprites? (Another yellow)
2) If I go to https://www.chasebot.com (secured connection) it is all garbled. Is that because of minify? because over http it is just fine. https://www.chasebot.com
3) Now that you know my settings, is there any other setting missing you would recommend?
Many Thanks for your time,