【发布时间】:2017-02-17 01:36:48
【问题描述】:
我在请求 sorial/app_dev.php 时得到这个:
Not Found
The requested URL /app_dev.php/ was not found on this server.
当请求sorial/app.php时:
注销(); $apcLoader->注册(真); */ $内核=新 AppKernel('prod', false); $kernel->loadClassCache(); //$内核=新 应用缓存($内核); // 使用HttpCache时,需要调用 前端控制器中的方法,而不是依赖于 配置参数 //Request::enableHttpMethodParameterOverride(); $请求 = 请求::createFromGlobals(); $response = $kernel->handle($request); $响应->发送(); $kernel->terminate($request, $response);
我在 Ubuntu 14.04 和 Apache 2.4 上
编辑:这是我的虚拟主机:
<VirtualHost *:80>
ServerName sorial
#ServerAlias sorial.es
DocumentRoot /var/www/sorial/web
DirectoryIndex app.php
#SetEnv SYMFONY__DATABASE__PASSWORD jander
<Directory /var/www/sorial/web/>
# Options Indexes FollowSymLinks MultiViews
AllowOverride All
#Order allow,deny
#allow from all
Require all granted
FallbackResource /index.php
# BEGIN EXPIRES
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 10 days"
ExpiresByType text/css "access plus 1 week"
ExpiresByType text/plain "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType application/x-javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 week"
ExpiresByType application/x-icon "access plus 1 year"
</IfModule>
# END EXPIRES
</Directory>
</VirtualHost>
我的文档根在/var/www/sorial/web。
事实上,我的其他网站也有同样的问题。当我尝试使用a2dismod env 禁用/启用env_mod 时,问题就开始了,因为在添加变量SetEnv 时(正如您在我的虚拟主机中看到的那样)我得到了
apache2.service 的作业失败,因为控制进程退出 错误代码。请参阅“systemctl status apache2.service”和“journalctl -xe" 了解详情。
重启 apache 时。
【问题讨论】:
-
您是否尝试过使用以下命令运行您的应用程序:php bin/console server:run?
-
您能告诉我们您的 Apache VirtualHost 或 DirectoryRoot 配置吗?我想知道你为 web 目录指定了什么?
-
@Giovani 谢谢,这是可行的,但我更喜欢使用 Apache。
-
@AlvinBunk 我编辑了我的问题。
-
为什么如果你的 VH 被命名为
sorial你试图得到my_site/app_dev.php而不是sorial/app_dev.php?还是打错了?