nginx篇最初级用法之SSL虚拟主机
注意:在源码安装nginx时必须要使用--with-http_ssl_module参数启动加密模块.
openssl genrsa > cert.key //使用openssl自己签发私钥
openssl req -new -x509 -key cert.key > cert.pem //签发证书
修改nginx配置文件,设置加密网站的虚拟主机
server {
listen 443 ssl;
server_name www.baidu.com;
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;
}
}