【问题标题】:apache vhost, loosing defaut routingapache vhost,丢失默认路由
【发布时间】:2016-04-02 11:56:20
【问题描述】:

我在 centos 6,apache, 安装 apache 后,当我输入我的服务器作为 URL 时,我得到了我的 index.html,它位于 /var/www/html 下。

现在我开始使用 VirtualHost,这是我的配置文件:

VirtualHost *:80>
     ServerAdmin xxx@xxx.com
     DocumentRoot /var/www/html/site
     ServerName www.xxx.net
     ServerAlias xxx.net
     ErrorLog /var/log/httpd/site/error.log
     CustomLog /var/log/httpd/site/out.log common
</VirtualHost>

因此,当我转到 www.xxx.net 时,我得到了我的 index.html,它位于 /var/www/html/site 下,这就是我想要的但是当我将我的服务器 ip 作为 URL 时,服务器重定向我去 www.xxx.net。

我想将我的服务器 IP 点保留在 /var/www/html/index.html 上!!! 有什么解决办法吗?

【问题讨论】:

    标签: apache routing vhosts


    【解决方案1】:

    所以我经过一些测试后得到它, 独奏: 取消注释这一行

    #NameVirtualHost *:80
    

    并为默认路由配置添加一个新的 VirtualHost,如下所示:

    <VirtualHost *:80>
         ServerAdmin xx@xxx.com
         DocumentRoot /var/www/html
         ServerName 212.212.212.212
         ServerAlias 212.212.212.212
         ErrorLog /var/log/httpd/gobal/error.log
         CustomLog /var/log/httpd/gobal/out.log common
    </VirtualHost>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-05-07
      • 2018-01-13
      • 1970-01-01
      • 1970-01-01
      • 2016-03-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多