BlueXIII's Blog

热爱技术,持续学习

0%

Nginx配置SSL

编译安装

下载全部源码
./configure –prefix=/path/to/nginx
–with-zlib=../zlib-1.2.8
–with-pcre=../pcre-8.39
–with-openssl=../openssl-1.1.0b
–with-http_ssl_module

生成证书

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

配置nginx.conf

server {
listen 443;
ssl on;
ssl_certificate /usr/local/nginx/conf/server.crt;
ssl_certificate_key /usr/local/nginx/conf/server_nopwd.key;
}