下面是工作在dev的包膜完全正常的頁面的例子,在督促ENV的Symfony:404錯誤生產
服務器沒有發現返回404錯誤
請求的URL /app/reporter/在此服務器上未找到。 的Apache/2.4.7(Ubuntu的)在symfony.dev端口80
不要讓自己由/應用/路由混淆,這在實際的路線,無關與app.php
運行php app/console router:debug --env=prod
並確認有與路由器沒有問題:
[router] Current routes
Name Method Scheme Host Path
reporter ANY ANY ANY /app/reporter/
當然,發佈此消息之前,我:
- 使用控制檯緩存清除緩存:clear --env = prod,以及直接刪除緩存文件,但這並沒有改變任何東西。
- 仔細檢查了mod_rewrite在的phpinfo是在
無論如何,我的猜測是錯誤出現更多來自Apache的所以這裏是我的conf:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName symfony.dev
SetEnv SYMFONY__TENANT__ID "123"
DocumentRoot /var/www/html/Symfony/web
# <Directory />
# Options FollowSymLinks
# AllowOverride None
# </Directory>
<Directory /var/www/html/Symfony/web >
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error-symfony.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access-symfony.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
在
/var/www/html/
,這裏只有一個符號鏈接:
lrwxrwxrwx 1 root root 29 mai 13 2014 Symfony -> /home/me/path/to/symfony
和我沒有改變任何東西在默認symfony /web/.htaccess
: 而不考慮可讀性的緣故評論
DirectoryIndex app.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^app\.php(/(.*)|$) %{ENV:BASE}/$2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .? - [L]
RewriteRule .? %{ENV:BASE}/app.php [L]
</IfModule>
<IfModule !mod_rewrite.c>
<IfModule mod_alias.c>
RedirectMatch 302 ^/$ /app.php/
</IfModule>
</IfModule>