I have an issue with my nginx configuration , i want to redirect www.yoursay.transport.nsw.gov.au to https://yoursay.transport.nsw.gov.au
Here is my configuration
server {
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/yoursay.transport.nsw.gov.au/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/yoursay.transport.nsw.gov.au/privkey.pem;
# enable OCSP stapling to speed up first connect
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /etc/letsencrypt/live/yoursay.transport.nsw.gov.au/chain.pem;
if ($host = www.$server_name) {
rewrite ^(.*) https://$server_name$request_uri? permanent;
}
server_name yoursay.transport.nsw.gov.au;
root /var/www/ehq;
add_header X-XSS-Protection "1; mode=block";
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload";
include snippets/common_blocks.inc;
}
server {
listen 80;
server_name yoursay.transport.nsw.gov.au;
return 301 https://yoursay.transport.nsw.gov.au$request_uri;
}
But still it doesnt works , it says ERR_CONNECTION_CLOSED
Please help me out to fix this issue .