Howto: easy cert generation and renewal with nginx

to make this a complete guide I would like to add how you could setup your https server as well:

server {
        listen 443 ssl;

        root /var/www/yourpath;
        index index.php index.html index.htm;

        # Make site accessible from http://localhost/
        server_name yourdomain.com www.yourdomain.com;

        # if you are using hhvm, otherwhise include your standard php config or whatever
        include hhvm.conf;

        location / {
             try_files $uri $uri/ /index.php$is_args$args;
        }

        ssl on;

        ssl_certificate /etc/letsencrypt/live/yourdomain.com/cert.pem;
        ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;

        ssl_stapling on;
        ssl_stapling_verify on;
        ssl_trusted_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;

        ssl_session_timeout 5m;
}
1 Like