安装.
[root@localhost ~]# dnf install nginx -y
切换到nginx主目录
[root@localhost ~]# cd /etc/nginx/
生成ssl 密钥
[root@localhost ~]# openssl req -new -newkey rsa:4096 -nodes -keyout server.key -out server.csr
生产自签名证书
[root@localhost ~]# openssl req -newkey rsa:4096 -nodes -keyout server.key -x509 -days 365 -out server.crt
备份nginx.conf
[root@localhost ~]# cp -p nginx.conf nginx.conf.bak
配置nginx.conf
[root@localhost ~]# vim nginx.conf
把这段去掉#号
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
server_name www.jnds.com; (域名)
root /usr/share/nginx/html; (网页存放路径)
ssl_certificate "/etc/nginx/server.crt"; (证书存放路径)
ssl