【问题标题】:Symfony 3 Virtual Hosts, can't make it to /webSymfony 3 虚拟主机,无法访问 /web
【发布时间】:2016-10-05 08:51:03
【问题描述】:

我正在尝试在我的本地服务器上设置 Symfony 3,但问题是我无法让我的虚拟主机工作。

虚拟主机文件:

<VirtualHost *:80>
    ServerName localhost.dev.lt
    ServerAlias www.localhost.dev.lt

    DocumentRoot /www/testProject/web
    <Directory /www/testProject/web/>
        AllowOverride None
        Order Allow,Deny
        Allow from All
    </Directory>

    # uncomment the following lines if you install assets as symlinks
    # or run into problems when compiling LESS/Sass/CoffeScript assets
    #<Directory /www/testProject/>
    #     Options FollowSymlinks
    #</Directory>
</VirtualHost>

我还将 localhost.dev.lt 添加到我的主机文件中。 Mod Rewrite 模块也已启用。

DocumentRoot URL 会不会写错? 如果我去http://localhost.dev.lt/testProject/web/ 然后它开始工作了,问题是我得到了根目录然后我去http://localhost.dev.lt而不是/web。

【问题讨论】:

  • 您应该更好地定义“它正在工作”或“它不工作”的含义。在每种情况下,您在页面上看到的具体内容是什么?
  • 这不是正确的配置。您应该将流量引导到 app(_dev).php,或者使用 AllowOverride All

标签: php apache virtualhost symfony


【解决方案1】:

如果导航到http://localhost.dev.lt/testProject/web/ 显示您的 Symfony 项目的主页,请确保您没有将localhost.dev.lt 设置为/www/不同虚拟主机。

【讨论】:

    【解决方案2】:

    哦,天哪,问题是 vhosts.conf 文件在主 httpd.conf 文件中被注释了,所以虚拟主机根本不工作。该行是“包括 conf/extra/httpd-vhosts.conf”。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-06-18
      • 1970-01-01
      • 1970-01-01
      • 2019-12-01
      • 2011-10-11
      • 1970-01-01
      • 1970-01-01
      • 2014-07-08
      相关资源
      最近更新 更多