【问题标题】:Apache2.4.11 virtualhostconfiguration is not workingApache2.4.11 虚拟主机配置不工作
【发布时间】:2015-10-13 08:08:18
【问题描述】:

我已经尝试使用下面的代码将域名指向特定目录进入 linux

NameVirtualHost *.80
<VirtualHost *:80>
     ServerName example.com
     DocumentRoot /var/www/html/example.com
</VirtualHost> 

但上面的代码不起作用。

【问题讨论】:

    标签: php linux apache lamp httpd.conf


    【解决方案1】:

    您是否运行过 a2ensite example.com.conf?之后重启apache。

    【讨论】:

      【解决方案2】:

      上面的代码是针对apache2.2的,所以你只需将上面的代码替换为

      <VirtualHost *:80>
         ServerName     example.com
         ServerAlias    www.example.com
         ServerAdmin    root@example.com
         DocumentRoot   "/var/www/html/example.com"
         CustomLog      "/var/www/html/example.com/access_log" combined
         ErrorLog       "/var/www/html/example.com/error_log"
      </VirtualHost>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2014-07-04
        • 2013-04-10
        • 2017-07-23
        • 2017-05-27
        • 1970-01-01
        相关资源
        最近更新 更多