我使用Symfony框架创建了项目,当我在生产或dev env中运行服务器构建时运行正常,但是现在我将项目移动到debian服务器,安装apache并创建虚拟主机。它仅显示目录列表,而不启动应用程序。我认为这是我的虚拟主机配置有问题。我正在使用 Apache/2.4.10 (Debian) 服务器,PHP 5.6.19-0+deb8u1 (cli)。
以下是虚拟主机的代码:
<VirtualHost *:80>
ServerName mose
ServerAlias 10.5.0.62
DocumentRoot /var/www/mose/web
<Directory /var/www/mose/web/>
AllowOverride None
Require all granted
Allow from All
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
</Directory>
# uncomment the following lines if you install assets as symlinks
# or run into problems when compiling LESS/Sass/CoffeScript assets
# <Directory /var/www/mose>
# Options FollowSymlinks
# </Directory>
# optionally disable the RewriteEngine for the asset directories
# which will allow apache to simply reply with a 404 when files are
# not found instead of passing the request into the full symfony stack
<Directory /var/www/mose/web/bundles>
<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>
</Directory>
ErrorLog /var/log/apache2/project_error.log
CustomLog /var/log/apache2/project_access.log combined
</VirtualHost>
正确的答案是Dawid Sajdak的AllowOverride All。Tnx 寻求帮助