【发布时间】:2018-09-14 18:54:32
【问题描述】:
我做错了什么?
这是我在 /etc/apache2/sites-enabled/hello-world.conf 上的配置
<VirtualHost *:80>
ServerName hello-world
DocumentRoot "/home/carlos/dev/github/hello-world/public"
<Directory "/home/carlos/dev/github/hello-world/public">
AllowOverride None
Order Allow,Deny
Allow from All
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
</Directory>
# uncomment the following lines if you install assets as symlinks
# or run into problems when compiling LESS/Sass/CoffeeScript assets
# <Directory /var/www/project>
# 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/project/public/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>
当我尝试访问 http://hello-world/index.php/lucky/number 时,一切正常。
但是使用 http://hello-world/lucky/number 我得到一个 404 Not Found。
404 错误是由于我配置了两个 VirtualHost。一个在 /etc/apache2/sites-enabled/000-default.conf 中,另一个在 /etc/apache2/sites-enabled/hello-world.conf 中。我在 000-default.conf 中删除了它,现在我收到“500 内部服务器错误”。我改变了这一行:
<Directory "/home/carlos/dev/github/hello-world/public">
# AllowOverride None
# Order Allow,Deny
Require all granted
# Allow from All –
...但我仍然得到 500。
在 /var/log/apache2/project_error.log 上有这条消息:
[Thu Apr 05 19:56:25.819680 2018] [core:error] [pid 4277] [client 127.0.0.1:38800] AH00125: Request exceeded the limit of 10 subrequest nesting levels due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
【问题讨论】:
-
你的操作系统是什么?
标签: php .htaccess symfony mod-rewrite apache2.4