Answer the question
In order to leave comments, you need to log in
How to correctly combine caching and www, https redirection for nginx?
In general, I wrote a redirect from www and http to https without www. Now I want to combine caching like in this article and my config. Can I use any other verified ports that are valid for SSL so as not to lose browser and search engine support?
Config:
server {
listen 80;
server_name .... www.site.com site.com;
return 301 https://site.com$request_uri;
}
server {
listen 443 ssl;
server_name .... www.site.com;
ssl_certificate /home/sv/certs/certificate.crt;
ssl_certificate_key /home/sv/certs/private.key;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_buffer_size 4k;
return 301 https://site.com$request_uri;
}
server {
gzip on;
gzip_buffers 16 8k;
gzip_comp_level 2;
gzip_min_length 1024;
gzip_types text/css text/plain text/json text/x-js text/javascript text/xml application/json application/x-java$
gzip_disable "msie6";
gzip_vary on;
gzip_http_version 1.0;
listen 443 ssl;
server_name .... site.com;
ssl_certificate /home/sv/certs/certificate.crt;
ssl_certificate_key /home/sv/certs/private.key;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_buffer_size 4k;
location /files/ {
alias /home/sv/site/static/;
}
location /pics/ {
alias /home/sv/site/media/;
}
location / {
include uwsgi_params;
uwsgi_pass unix:/run/uwsgi/site.sock;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question