docker | nginx泛域名解析如何配置

2020-04-16  本文已影响0人  炒面Z

概述

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
上一篇 下一篇

猜你喜欢

热点阅读