1. Prepare the certificate file
I am using the Alibaba Cloud Symantec free version ssl certificate. Download the certificate file and decompress it to get the following file
Create an ssl directory in the nginx–>cert directory and copy all the above files to the ssl directory.
2. Modify the nginx.conf file
Fill in the following content in http{} of nginx.conf
server { listen 443; server_name www.httpstest.com; ssl on; root html; index index.html index.htm; #这里的.pem/.key文件替换成自己对应的文件名 ssl_certificate cert/xxxxx.pem; ssl_certificate_key cert/xxxx.key; ssl_session_timeout 5m; ssl_ciphers ecdhe-rsa-aes128-gcm-sha256:ecdhe:ecdh:aes:high:!null:!anull:!md5:!adh:!rc4; ssl_protocols tlsv1 tlsv1.1 tlsv1.2; ssl_prefer_server_ciphers on; location / { #代理的目标地址 proxy_pass http://127.0.0.1:10443; } }
Finally, don’t forget to restart nginx service.
The above is the detailed content of How to configure Nginx to monitor SSL certificate on port 443. For more information, please follow other related articles on the PHP Chinese website!