24 lines
982 B
Plaintext
24 lines
982 B
Plaintext
# dsh.alotbuy.com —— 旧域名(2026-09-10 平台迁移到 alotbuy.com 后仅做 301 跳转)
|
|||
|
|
# 用 map + 通配 server_name(比正则 server_name 更稳),保留用户名映射:
|
||
|
|
# admin.dsh.alotbuy.com → admin.alotbuy.com
|
||
|
|
# dsh.alotbuy.com → alotbuy.com
|
||
|
|
# map 必须位于 http 上下文 —— 面板 vhost 文件正是被 include 在 http{} 内,故写在本文件顶层。
|
||
|
|
|
||
|
|
map $host $alotbuy_new_host {
|
||
|
|
default alotbuy.com;
|
||
|
|
~^(?<label>[^.]+)\.dsh\.alotbuy\.com$ $label.alotbuy.com;
|
||
|
|
}
|
||
|
|
|
||
|
|
server {
|
||
|
|
listen 80;
|
||
|
|
server_name dsh.alotbuy.com *.dsh.alotbuy.com;
|
||
|
|
return 301 https://$alotbuy_new_host$request_uri;
|
||
|
|
}
|
||
|
|
|
||
|
|
server {
|
||
|
|
listen 443 ssl;
|
||
|
|
server_name dsh.alotbuy.com *.dsh.alotbuy.com;
|
||
|
|
ssl_certificate /etc/letsencrypt/live/dsh.alotbuy.com/fullchain.pem;
|
||
|
|
ssl_certificate_key /etc/letsencrypt/live/dsh.alotbuy.com/privkey.pem;
|
||
|
|
return 301 https://$alotbuy_new_host$request_uri;
|
||
|
|
}
|