Generate Self-signed SSL Certificate for nginx

You can easily generate self-signed SSL certificate for your local machine using openssl this command line tool

openssl req -x509 -nodes -days 365 -newkey rsa:1024 \
    -keyout /etc/ssl/private/mylocal.key \
    -out /etc/ssl/certs/mylocal.crt

Now you can change your nginx config to use these certificates. Add the following section

server {
    listen               443 ssl;
    ssl_certificate      /etc/ssl/certs/mylocal.crt;
    ssl_certificate_key  /etc/ssl/private/mylocal.key;
    server_name mylocal.local *.mylocal.local;
    set $MAGE_ROOT /projects/mylocal;
    include /projects/mylocal/nginx.conf.sample;
}
Share
Plus
2019   certificate   nginx   ssl
Popular