【问题标题】:Cant set Virtual host with Xampp无法使用 Xampp 设置虚拟主机
【发布时间】:2013-11-16 19:08:14
【问题描述】:

我正在尝试设置我的虚拟主机。

这是我的Hosts文件

的设置
    127.0.0.1       localhost
    127.0.0.1       test.local

这是我在 httpd-Vhosts.Conf 文件中的设置

 <VirtualHost 127.0.0.1:80>
DocumentRoot "C:/xampp/htdocs/test"
ServerName http://test.local/
ErrorLog "logs/dummy-host2.example.com-error.log"
CustomLog "logs/dummy-host2.example.com-access.log" common</VirtualHost>

这是我遇到的错误,

  Server error!

 The server encountered an internal error and was unable to complete your request.      Either the server is overloaded or there was an error in a CGI script.

 If you think this is a server error, please contact the webmaster.
 Error 500

我已经启用了这条线

  Include conf/extra/httpd-vhosts.conf

但我不知道我在这里缺少什么来创建虚拟主机。

【问题讨论】:

    标签: php apache xampp virtualhost


    【解决方案1】:
    <VirtualHost 127.0.0.1:80>
    DocumentRoot "C:/xampp/htdocs/test"
    ServerName test.local
    ErrorLog "logs/dummy-host2.example.com-error.log"
    CustomLog "logs/dummy-host2.example.com-access.log" common
    </VirtualHost>
    

    有两个问题可能会阻止 Apache 正确解释您的文件:

    • &lt;/VirtualHost&gt; 必须换行,否则 Apache 无法解析文件 (Syntax error)
    • ServerName 通常放在不带http:// 和尾部斜杠的位置

    (此外,您不应使用.local,因为这可能会干扰某些网络内容。)

    【讨论】:

    • 已经在新行中,由于某种原因我无法在此处将其粘贴到新行中。我也尝试删除 http:// 和斜杠仍然没有希望
    • 你重启了 Apache 吗? Apache 错误日志说明了什么(应该在 &lt;xampp-dir&gt;\apache\logs\error.log 中的某处)?
    猜你喜欢
    • 2014-01-14
    • 2014-05-22
    • 2018-05-16
    • 2017-10-21
    • 1970-01-01
    • 2012-08-04
    • 2014-10-05
    • 2021-08-30
    • 2020-07-29
    相关资源
    最近更新 更多