Ubuntu 18.04
Sponsored Link

Nginx : SSL/TLS Setting2018/07/02

 
Enable SSL/TLS setting to use SSL connection.
[1]
[2] Configure Nginx.
root@www:~#
vi /etc/nginx/sites-available/default
# add to the end

# replace the path of certificates to your own one

server {
        listen 443 ssl default_server;
        listen [::]:443 ssl default_server;

        ssl_prefer_server_ciphers  on;
        ssl_ciphers  'ECDH !aNULL !eNULL !SSLv2 !SSLv3';
        ssl_certificate  /etc/letsencrypt/live/www.srv.world/fullchain.pem;
        ssl_certificate_key  /etc/letsencrypt/live/www.srv.world/privkey.pem;

        server_name www.srv.world;
        location / {
                try_files $uri $uri/ =404;
        }
}

root@www:~#
systemctl restart nginx

[3] If you'd like to set HTTP connection to redirect to HTTPS (Always on SSL/TLS), configure like follows.
root@www:~#
vi /etc/nginx/sites-available/default
# add into the section of listening 80 port

server {
        listen 80 default_server;
        listen [::]:80 default_server;
        return 301 https://$host$request_uri;

root@www:~#
systemctl restart nginx

[4] Verify to access to the test page from a client computer with a Web browser via HTTPS. If you set Always On SSL/TLS, access with HTTP to verify the connection is redirected to HTTPS normally, too.
Matched Content