nginx配置服务 ssl - 2877206/docs GitHub Wiki

https://blog.csdn.net/qq_17054659/article/details/77186249 https://www.jianshu.com/p/df050fd7d64e

修改nginx配置文件,开启pid pid /var/run/nginx.pid;

[Unit] Description=nginx - high performance web server After=network.target remote-fs.target nss-lookup.target

[Service] Type=forking PIDFile=/var/run/nginx.pid ExecStartPre=/opt/nginx/sbin/nginx -t -c /opt/nginx/conf/nginx.conf ExecStart=/opt/nginx/sbin/nginx -c /opt/nginx/conf/nginx.conf ExecReload=/opt/nginx/sbin/nginx -s reload ExecStop=/opt/nginx/sbin/nginx -s stop ExecQuit=/opt/nginx/sbin/nginx -s quit PrivateTmp=true

[Install] WantedBy=multi-user.target

systemctl daemon-reload 这时就可以利用systemctl进行配置了 systemctl start/stop/reload/quit nginx.service 若发生报错,可通过systemctl status nginx.service查看失败原因 systemctl enable nginx.service 开机自启动

ssl https://blog.csdn.net/xuplus/article/details/51613883

openssl req -new -newkey rsa:2048 -sha256 -nodes -out nc.lyw.csr -keyout nc.lyw.key -subj "/C=CN/ST=ShenZhen/L=ShenZhen/O=Example Inc./OU=Web Security/CN=nc.lyw"

openssl req -new -x509 -key nc.lyw.key -out ca.crt -days 3650

openssl x509 -req -days 3650 -in nc.lyw.csr -CA ca.crt -CAkey nc.lyw.key -CAcreateserial -out nc.lyw.crt