Nginx 环境
小于 1 分钟
Nginx 环境
1 Downloads
nginx-1.22.1.zip
: https://nginx.org/en/download.html
2 启动
cd c:\
unzip nginx-1.23.3.zip
cd nginx-1.23.3
start nginx
# fast shutdown
nginx -s stop
# graceful shutdown
nginx -s quit
# changing configuration, starting new worker processes with a new configuration, graceful shutdown of old worker processes
nginx -s reload
# re-opening log files
nginx -s reopen
3 PKI 证书安装
linux
# 解压
unzip cert.zip
# 安装证书(需密码)
openssl pkcs12 -in cert.pfx -nodes -out server.pem
# 私钥
openssl rsa -in server.pem -out server.key
# 公钥
openssl x509 -in server.pem -out server.crt
windows (git bash)
# 解压
unzip cert.zip
# 安装证书(需密码)
openssl pkcs12 -in cert.pfx -nodes -out server.pem -password pass:"证书密码"
# 私钥
openssl rsa -in server.pem -out server.key
# 公钥
openssl x509 -in server.pem -out server.crt
nginx.conf
server {
listen 80;
server_name xxx.com
}
server {
listen 443;
server_name xxx.com;
ssl_certificate server.crt;
ssl_certificate_key server.key;
}
(全文完)