欢迎访问服务器技术网-www.fuwuqijishu.com

Nginx网站环境实现子域名泛解析设置

运维 fuwuqijishu 2年前 (2022-09-04) 63次浏览 0个评论 扫描二维码

有一些做站群的站长可能会需要用到泛解析域名功能,比如在同样的内容或者有时候随机页面解析到主域名的泛域名。以前也有接触过这类的网站项目,但是都没有操作过。如果是NGINX网站环境配置起来还是比较简单的,尤其是我们使用的服务器比虚拟主机简单。

server {
server_name
example.com
http://www.example.com
*.example.com;
set $subdomain ”;
if ($host ~* (\b(?!www\b).+)\.example.com) {
set $subdomain -$1;
}
root /home/wwwroot/www$subdomain/;
}

这是代码部分,我们需要在域名解析面板 解析 *到服务器IP地址。然后根据实际网站域名修改。

喜欢 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

Warning: error_log(/www/wwwroot/fuwiqijishu/wp-content/plugins/spider-analyser/#log/log-0209.txt): failed to open stream: No such file or directory in /www/wwwroot/fuwiqijishu/wp-content/plugins/spider-analyser/spider.class.php on line 2900