每个网站使用独立的配置文件然后在nginx.conf引入配置文件,注意:配置文件的网站文件路径须为绝对路径
**先在nginx.conf文件引入独立配置文件**
http{
include C:/Users/Administrator/Desktop/WebSite(dev)/ETSBussiness/web.conf;
}
下面为ETSBussiness/web.conf里面的配置代码
# 天泽云测试库
server {
listen 443 ssl;
server_name dev.techzeniot.com;
# 默认设置
#charset koi8-r;
#access_log logs/host.access.log main;
# 配置ssl证书
ssl_certificate C:/certificate/dev.techzeniot.com/Nginx/1_dev.techzeniot.com_bundle.crt;
# 配置证书秘钥
ssl_certificate_key C:/certificate/dev.techzeniot.com/Nginx/2_dev.techzeniot.com.key;
ssl_session_timeout 5m;
#请按照以下协议配置
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
# 配置加密套件,写法遵循 openssl 标准
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
location / {
root "C:/Users/Administrator/Desktop/WebSite(dev)/ETSBussiness";
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
}
server {#配置跳转https
listen 80;
#填写绑定证书的域名
server_name dev.techzeniot.com;
#把http的域名请求转成https
return 301 https://$host$request_uri;
}
版权声明:本文为博主小治ppg原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/qq_35431416/article/details/108101416