How to setup Let's Encrypt Wildcard SSL certificate for Nginx





In this post i well show you how to setup Nginx to service your content using https protocol and let's encrypt new wildcard ssl certificate .


If you don't know to issue wildcard ssl certificate please read this post first :

https://fiftysoft.blogspot.com/2018/03/step-by-step-how-to-issue-letsencrypt.html


Config Nginx to use ssl certificate


edit nginx.conf file to be like this config example :

user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    ssl_session_timeout 1d;
    ssl_session_cache shared:SSL:50m;
    ssl_session_tickets off;

    ssl_protocols TLSv1.2;
    ssl_ciphers EECDH+AESGCM:EECDH+AES;
    ssl_ecdh_curve secp521r1;
    ssl_prefer_server_ciphers on;

    ssl_stapling on;
    ssl_stapling_verify on;

    add_header Strict-Transport-Security "max-age=15768000; includeSubdomains; preload";
    add_header X-Frame-Options DENY;
    add_header X-Content-Type-Options nosniff;

    ssl_certificate      /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key  /etc/letsencrypt/live/example.com/privkey.pem;

    include /etc/nginx/conf.d/*.conf;
}



At end don't forgot to edit default.conf file :

listen 80 default_server;
listen 443 ssl;
server_name  example.com;

then you should restart you Nginx if you have any questions use comments.

Comments

Popular posts from this blog

how to install nginx rtmp monitoring dashboard

Laravel 5.3 multiple image upload and resize