开发者社区 问答 正文

wdcp面板域名绑定求助

wdcp,环境是 nginx+apache ,我只绑定了 bbs.hantoll.com 和m.hantoll.com 的域名,可是访问hantoll.com自动跳转到了bbs.hantoll.com 这是什么情况?






配置文件里面绑定的域名我重新修改了,而且服务也重启了,可是域名访问一直没有生效


nginx/conf/vhost/hantoll.com.conf文件配置为:



server {
        listen       80;
        server_name bbs.hantoll.com m.hantoll.com;
        root /www/web/hantoll_com/public_html;
        index  index.html index.php index.htm;
        error_page  400 /errpage/400.html;
        error_page  403 /errpage/403.html;
        error_page  404 /errpage/404.html;
        location ~ \.php$ {
                proxy_pass http://127.0.0.1:88;
                include naproxy.conf;
        }
        location / {
                try_files $uri @apache;
        }
        location @apache {
                 proxy_pass http://127.0.0.1:88;
                 include naproxy.conf;
        }
}        

/apache/conf/vhost/hantoll.com.conf配置文件为

<VirtualHost *:88> DocumentRoot /www/web/hantoll_com/public_html
ServerName hantoll.com ServerAlias bbs.hantoll.com m.hantoll.com
ErrorDocument 400 /errpage/400.html ErrorDocument 403 /errpage/403.html
ErrorDocument 404 /errpage/404.html include conf/rewrite/hantollbbs.conf
php_admin_value open_basedir /www/web/hantoll_com:/tmp <IfModule mod_deflate.c>
DeflateCompressionLevel 7 AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-httpd-php
AddOutputFilter DEFLATE css js html htm gif jpg png bmp php </IfModule>
</VirtualHost> <Directory /www/web/hantoll_com>
    Options FollowSymLinks     AllowOverride All
    Order allow,deny     Allow from all
</Directory>        

展开
收起
akak2012 2014-09-27 21:26:57 8255 分享 版权
阿里云 AI 助理回答

从你提供的配置信息来看,问题可能出在以下几个方面:

  1. Nginx 配置:你的 Nginx 配置文件中只绑定了 bbs.hantoll.comm.hantoll.com,并没有直接为 hantoll.com 设置单独的 server block。这意味着当访问 hantoll.com 时,Nginx 会使用默认的 server block 处理请求,如果没设置默认或者有其他配置导致自动跳转到 bbs.hantoll.com

  2. Apache 配置:虽然你提供了 Apache 的配置,但需要注意的是,在使用 Nginx 反向代理到 Apache 的架构中,主要由 Nginx 负责处理域名解析和路由。Apache 的配置看起来是正确的,指定了 DocumentRoot 并且通过 ServerAlias 包含了所有子域名,但这不会直接影响到 Nginx 的路由行为。

  3. 潜在的重定向规则:检查是否有其他的重定向规则(如 .htaccess 文件中的规则或 Nginx 中未显示的其他 location 配置)导致了从 hantoll.com 自动跳转到 bbs.hantoll.com。特别注意是否有全局的 rewrite 规则或者在其他配置文件中对根域名进行了重定向设置。

  4. 缓存问题:浏览器缓存或DNS缓存可能导致旧的配置仍然生效。尝试清除浏览器缓存,或者使用 "Ctrl + Shift + R" 进行硬刷新。对于DNS缓存,可以尝试更换网络环境访问,或者等待DNS更新(TTL时间过后)。

  5. 重启服务确认:你提到已经重启了服务,但请确保确实都已成功重启。有时候服务看似重启了,但实际上可能因为某些原因没有完全应用新的配置。可以查看服务日志来确认配置是否正确加载,以及是否有错误提示。

解决办法建议:

  • 添加 Nginx 对 hantoll.com 的处理:如果你希望直接访问 hantoll.com 时展示特定内容或保持独立处理,你需要在 Nginx 配置中为 hantoll.com 添加一个单独的 server block,或者修改现有配置以包含对根域名的处理逻辑。

例如,可以在 Nginx 配置中增加如下 server block 来处理根域名:

server {
    listen       80;
    server_name  hantoll.com;
    # 根据需要设置根目录、索引文件等
    root /www/web/hantoll_com/public_html_root; # 假设这是为根域名准备的根目录
    index index.html index.php;
    # 其他必要的配置...
}
  • 检查并清理重定向规则:确保没有任何意外的重定向规则导致了自动跳转。

  • 彻底清除缓存:确保测试时没有受到缓存影响。

  • 再次验证配置并重启服务:仔细检查配置文件无误后,再次重启 Nginx 和 Apache 服务,并检查日志以确认配置被正确应用。

有帮助
无帮助
AI 助理回答生成答案可能存在不准确,仅供参考
0 条回答
写回答
取消 提交回答