nginx:ssl

Generating a certificate A simple certificate

can be by following these steps:
First, go to the directory where you want to create the certificate and private key, for example:

cd /usr/local/etc/nginx/
create server private key, the command will ask you to enter a password:

openssl genrsa -des3 -out server.key 1024
Create a certificate (CSR) for signing the request:

openssl req -new -key server.key -out server.csr
Remove the required passphrase when loading Nginx with SSL support and using the above private key:

cp server.key server.key.org
openssl rsa -in server.key.org -out server.key

configure nginx

and finally sign the certificate using the above private key and CSR:
openssl x509 -req -days 365 -in server.csr -signkey server .key -out server.crt

Modify the Nginx configuration file to include the newly marked certificate and private key:

server {
        listen 8080;
        server_name localhost;

        ssl on;
        ssl_certificate /usr/local/etc/nginx/server.crt;
        ssl_certificate_key /usr/local/etc/nginx/server.key;
        ssl_session_cache shared:SSL:1m;
        ssl_session_timeout 5m;
        ssl_ciphers HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers on;

        location / {
            root html;
            index index.html index.htm;
        }
}
Restart nginx

so that it can be accessed via:
https://localhost:8080

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326306267&siteId=291194637