split nginx config by domain
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
server {
|
||||
# https://serverfault.com/questions/798734/use-variable-for-server-name-in-nginx#
|
||||
# server_name $servername;
|
||||
server_name "music-room.huiwings.cn";
|
||||
listen 443 ssl;
|
||||
client_max_body_size 10M;
|
||||
|
||||
set $resty_loc "/usr/local/openresty";
|
||||
|
||||
# disable in local test env
|
||||
ssl_certificate /etc/letsencrypt/live/huiwings.cn/fullchain.pem; # managed by Certbot
|
||||
ssl_certificate_key /etc/letsencrypt/live/huiwings.cn/privkey.pem; # managed by Certbot
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
proxy_set_header Host "music-room.huiwings.cn";
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
# disable in local test env
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header X-Forwarded-Host $remote_addr;
|
||||
}
|
||||
|
||||
root $resty_loc/nginx/html/huiwing/music-room;
|
||||
index index.html;
|
||||
|
||||
# 公众号校验
|
||||
location /MP_verify_Jo6pKmy43wx7S5Sh.txt {
|
||||
return 200 'Jo6pKmy43wx7S5Sh';
|
||||
}
|
||||
|
||||
# 小程序业务域名校验
|
||||
location /Q25f8xC3Jo.txt {
|
||||
return 200 '323072b225a694281cd23496fa6737ef';
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name "music-room.huiwings.cn";
|
||||
location / {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user