環(huán)境
系統(tǒng)環(huán)境:CentOS7
nginx version: nginx/1.8.1
證書
www.scwdjk.com.crt
www.scwdjk.com.key
配置
vim nginx.conf
找到以下內(nèi)容
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.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;
# }
#}
修改為:
# HTTPS server
#
server {
listen 443 ssl;
server_name localhost;
ssl_certificate /root/ssl/www.scwdjk.com.crt;
ssl_certificate_key /root/ssl/www.scwdjk.com.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;
}
}
檢查配置
/opt/nginx/sbin/nginx -t
重啟Nginx生效
/opt/nginx/sbin/nginx -s reload
注意:如果是多臺主備結(jié)構(gòu)nginx,分別配置重啟即可状您。