扫码关注官方订阅号
例如:a.example.com/index.html 对应 /a-direcoty/index.html,而b.example.com/index.html 对应 /b-direcoty/index.html
a.example.com/index.html
/a-direcoty/index.html
b.example.com/index.html
/b-direcoty/index.html
人生最曼妙的风景,竟是内心的淡定与从容!
server { listen 80; server_name ~^(?<subdomain>.+).example.com$; index index.html index.htm; root /$subdomain-direcoty/; }
nginx配置文件可以设置server段,在server中设置server_name来指定域名。所以你这种情况就设置两个server,分别是两个域名,然后再设置root为具体目录
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
扫描下载App
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
nginx配置文件可以设置server段,在server中设置server_name来指定域名。所以你这种情况就设置两个server,分别是两个域名,然后再设置root为具体目录