【发布时间】:2017-12-10 15:47:46
【问题描述】:
这里是我从官网取的配置:https://symfony.com/doc/current/setup/web_server_configuration.html(没有使用.htaccess的那个),我把它放在这里:/etc/apache2/sites-enabled/000-default.conf。我也改变了一些路径,现在我有了这个:
<VirtualHost *:80>
ServerName domain.tld
ServerAlias www.domain.tld
DocumentRoot /home/shade/Documents/webchat/public
<Directory /home/shade/Documents/webchat/public>
AllowOverride None
Require all granted
Allow from All
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
</Directory>
<Directory /home/shade/Documents/webchat/public>
<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>
</Directory>
ErrorLog /var/log/apache2/project_error.log
CustomLog /var/log/apache2/project_access.log combined
当我输入 'localhost' 时,我收到消息说没有 '/' 的路由,这是真的(此消息来自 symfony)。但我确实有 /lucky/number 的路线,当我输入“localhost/lucky/number”时,我收到一条 404 Not Found 消息。我的 Apache Web 服务器有什么问题?如果我使用内置的 php web 服务器,一切正常。但我不知道 Apache 出了什么问题。
【问题讨论】:
-
你在
ServerName中使用domain.tld -
我已经删除了,谢谢,可惜还是不行。
-
是的,我已经重新加载了我的 apache 网络服务器
-
你是如何在 Symfony 中配置路由的?