Symfony 框架安装 406 不可接受错误 w/CPanel & WHM

Symfony framework install 406 Not Acceptable Error w/CPanel & WHM

所以我试图按照这些安装说明让 Symfony 在我的服务器上运行。

http://symfony.com/doc/current/book/installation.html#book-installation-permissions

我到达了 运行 在我希望安装框架的目录中的控制台中执行此命令的部分。

symfony 新 my_project_name

然后我按照这些说明将我的网络根目录设置为 /web,我认为我应该这样做?

它正确安装了所有文件,因为我可以在文件夹中看到它们。我确保重新启动了 apache,并且确定文档根目录位于正确的位置。

http://tecadmin.net/how-to-change-document-root-of-primary-domain-in-cpanel/#

执行此操作后,我应该能够测试安装,但除了 406 错误之外似乎没有任何反应?

这正是我得到的错误。

An appropriate representation of the requested resource /app.php could not be found on this server.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

我不知道还能做什么。

请注意,由于我使用的是 CPANEL 如果这是问题所在,我无法更改 apache 的虚拟主机配置,所以我正在寻找 CPanel具体答案。谢谢!

好吧,我终于想出了要做什么,我遇到了 2 个问题。因为我是作为 'root' 用户安装的,所以我必须 运行 在 symfony 安装中执行以下命令。

chown -R devdistribution:devdistribution .

就我而言,我的用户名是 devdistribution,但您可以输入自己的用户名。确保在顶层执行此操作,而不仅仅是 /web 文件夹。

我知道这是其中一个错误,因为 apache 日志说了一些类似的话

文件“/home/devdistribution/public_html/distribution_tech/web/app.php”的目标 UID (520) 和 UID (501) 不匹配

这修复了 500 错误,但没有修复 406。要修复 406 错误,您需要登录 WHM 并键入 modsecurity 以在搜索字段中找到它。

转到它的配置选项,你会看到这个。

Rules Engine SecRuleEngine 
This setting controls the behavior of the rules engine.
 Process the rules.
 Do not process the rules.
 Process the rules in verbose mode, but do not execute disruptive actions.

Select'Do not process the rules'。然后保存在底部。这解决了我的问题,我能够看到打开的 symfony 屏幕!

但是,我确信这现在会留下安全漏洞...所以我仍然需要帮助以正确的方式处理 mod 在这种情况下使用 symfony 的安全性,如果有人知道的话?我会为此单独提出一个问题。