docker | nginx泛域名解析如何配置
作者:
炒面Z | 来源:发表于
2020-04-16 13:47 被阅读0次
概述
- 泛域名解析SSL证书需要购买支持泛域名类型的证书
- nginx配置文件也需要支持泛域名解析
nginx配置文件
server {
listen 443 ssl;
listen 80;
# ssl on;
server_name ~^(?<subdomain>.+)\.test\.hexiangedu\.cn$;
#index index.html;
ssl_certificate /etc/nginx/conf.d/edu-ssl/3774891__hexiangedu.cn.pem;
ssl_certificate_key /etc/nginx/conf.d/edu-ssl/3774891__hexiangedu.cn.key;
#让http请求重定向到https请求
if ($server_port = 80){
#return 301 https://$server_name$request_uri;}
return 301 https://$host$request_uri;}
if ($scheme = http){
#return 301 https://$server_name$request_uri;}
return 301 https://$host$request_uri;}
error_page 497 https://$server_name$request_uri;
# 网课微信公众号模板
location / {
add_header Cache-Control 'private, no-store, max-age=0';
alias /usr/share/nginx/wechat-course-template/;
index index.html;
try_files $uri $uri/ /index.html;
}
# 微信授权域名配置文件 - 微信的授权文件都放MP_verify文件夹下
location ~ /MP_verify_(.+)\.(txt)$ {
root /usr/share/nginx/MP_verify;
}
}
域名解析配置

image.png
本文标题:docker | nginx泛域名解析如何配置
本文链接:https://www.haomeiwen.com/subject/lxervhtx.html
网友评论