Nginx 搭建 HTTPS 服务器
首先安装 OpenSSL,用
# openssl
测试是否安装成功
# cd /usr/local/nginx/conf
# openssl genrsa -des3 -out server.key 1024
# openssl req -new -key server.key -out server.csr
# openssl rsa -in server.key -out server_nopwd.key
# openssl x509 -req -days 365 -in server.csr -signkey server_nopwd.key -out server.crt
配置服务器
server {
listen 443;
ssl on;
ssl_certificate /usr/local/nginx/conf/server.crt;
ssl_certificate_key /usr/local/nginx/conf/server_nopwd.key;
location /your_path {
root /your/root/directory;
index index.html index.htm;
}
}
参考
- http://www.cnblogs.com/tintin1926/archive/2012/07/12/2587311.html
- http://www.heyuan110.com/?p=1285