I have the following questions about my server block(s) for a WordPress site running solely on https, with nginx and W3TC browser caching.
Environment:
Ubuntu - 14.04LTS
nginx - 1.4.6
PHP - 5.5.9
mysql - Ver 14.14 Distrib 5.5.41
My questions are as follows:
- Does the order of the "location" sections matter?
- Does the order of the W3TC block matter?
- I've seen some where "ssl" is put in the listen directive instead of using "ssl on;" later -- does it matter?
- I handle www => non-www in the top server block, but I'm not explicitly addressing http://domain.com => https://domain.com (forcing SSL) -- yet it somehow is doing that for me. Any ideas why that's working even though I haven't told it to? I'm glad it's working, I just want to understand why it's working.
- Any other general advice on the setup is appreciated as well. Thanks!
Virtual Host Config:
server { server_name www.domain.com; rewrite ^(.*) https://domain.com$1 permanent; } server { listen 443 default_server; server_name domain.com; root /usr/share/nginx/html/domain.com; index index.php index.html index.htm; # BEGIN W3TC Browser Cache gzip on; gzip_types text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon; # END W3TC Browser Cache ssl on; ssl_certificate /etc/ssl/certs/domain.com.rapidssl.crt; ssl_certificate_key /etc/ssl/private/domain.com.key; ssl_session_timeout 5m; ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES"; ssl_prefer_server_ciphers on; location / { try_files $uri $uri/ /index.php?q=$uri&$args; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } }