在Nginx中使用SSL安全协议
在 Nginx 中使用 SSL 安全协议
直接上代码:
listen 443 ssl;
server_name fengxinzi.biz;
ssl_certificate /opt/nginx/conf/ssl/server.crt;
ssl_certificate_key /opt/nginx/conf/ssl/server.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
其中的 ssl_certificate ssl_certificate_key 为证书 如下一段代码是 nginx 内部示例代码:
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;
}
}