nginx - Getting 301 after upgrading http to https -
i trying serve static index html , upgrade http request https. let's file below bursan. weirdly when have file, pointing domain name, siosan managed working. bursan, keep getting 301s.
server { listen 80; server_name bursan.co.uk; return 301 https://bursan.co.uk$request_uri; } server { listen 443 ssl; root /var/www/html/bursan; index index.html; server_name bursan.co.uk; ssl_certificate /etc/nginx/ssl/bursan.crt; ssl_certificate_key /etc/nginx/ssl/bursan.key; add_header strict-transport-security "max-age=31536000"; # set preferred protocols , ciphers. tls1.2 required http/2 ssl_protocols tlsv1 tlsv1.1 tlsv1.2; ssl_prefer_server_ciphers on; ssl_ciphers ecdh+aesgcm:ecdh+aes256:ecdh+aes128:dh+3des:!adh:!aecdh:!md5; # cache ssl connections ssl_session_cache shared:ssl:2m; ssl_session_timeout 60m; location / { try_files $uri $uri/ /index.html; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } }
what if try
listen 443 ssl default_server;
instead of
listen 443 ssl;
(don't forget reload conf , test incognito window avoid cache issues)
Comments
Post a Comment