配置 HTTPS

安装 openssl

yum install openssl

生成证书 , 证书会生成在当前目录

openssl genrsa -des3 -out private.key 2048
openssl req -new -key private.key -out server.csr
openssl rsa -in private.key -out server.key
openssl x509 -req -in server.csr -out server.crt -signkey server.key -days 3650

需要填写的信息,还有密码

Country Name : CN
Province Name : GuangDong
City Name : GuangZhou
Company : mhace
section : mhace
Common Name : 192.168.1.220
Email Address : ....
配置 HTTPS_第1张图片
TIM截图20180115111236.png

需要填写的信息,还有密码

mkdir /etc/nginx/ssl
cp server.* /etc/nginx/ssl/
cp private.key /etc/nginx/ssl/

systemctl restart nginx.service
nginx -t
vi dev.conf 
systemcl openssl version
openssl version

nginx 配置

server {
    listen        443;
    server_name   192.168.1.220 *.n.com;

    ssl on;
    ssl_certificate /etc/nginx/ssl/server.crt;
    ssl_certificate_key /etc/nginx/ssl/server.key;
}

你可能感兴趣的:(配置 HTTPS)