第一步,制作加密证书
# cd /etc/nginx/
# openssl genrsa > cert.key
# openssl req -new -x509 -key cert.key > cert.pem
第二步,nginx 开启ssl
[root@localhost conf.d]# cat wenruo.conf
server {
listen 443;
server_name 10.1.234.101;
ssl on;
ssl_certificate /etc/nginx/cert.pem;
ssl_certificate_key /etc/nginx/cert.key;
ssl_session_timeout 5m;
ssl_protocols SSLv2 SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers on;
add_header Cache-Control no-cache;
location / {
root /usr/share/nginx/html;
#proxy_read_timeout 220s
index index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
重启nginx ,servername 可以用域名,也可以用ip