我的应用程序在本地环境中工作,我部署在VPS服务器上,由我管理,源代码由Git使用SSH部署。
您会看到导航无效,我已经将网站工作到Web服务器中,但是使用URL http://jw-motorsport.fr/public并不方便,因此我决定管理我的虚拟主机以定义入口点{ {3}},现在,路由不起作用-_-'
我在日志中没有看到任何错误。 (HTTP日志)
这个问题困扰了我很多周,我尝试了很多问题,但我不记得我为此做的一切^
我的路线。yaml:
Index:
path: /
controller: App\Controller\IndexController::accueil
Accueil:
path: /Accueil
controller: App\Controller\IndexController::accueil
HelloName:
path: /hello-world/{name}
controller: App\Controller\IndexController::helloName
Reprog:
path: /Reprog
controller: App\Controller\ReprogController::reprog
NosVoitures:
path: /NosVoitures
controller: App\Controller\NosVoituresController::nosVoitures
Contact:
path: /Contact
controller: App\Controller\ContactController::contact
Services:
path: /Services
controller: App\Controller\ServicesController::services
虚拟主机:
<VirtualHost *:80>
ServerName jw-motorsport.fr
ServerAlias www.jw-motorsport.fr
DocumentRoot /var/www/jw-motorsport.fr/html/public
<Directory /var/www/jw-motorposrt.fr/html/public>
AllowOverride All
Order Allow,Deny
Allow from All
</Directory>
ErrorLog /var/www/jw-motorsport.fr/log/error.log
CustomLog /var/www/jw-motorsport.fr/log/requests.log combined
</VirtualHost>
是否需要其他src?
我已经清除了我的缓存,曲目具有755权限,并且所有者不是root。
我已经安装了apache-pack。
当我显示可用路线时,我有:
[root@vps60891 html]# php bin/console debug:route
------------- -------- -------- ------ ---------------------
Name Method Scheme Host Path
------------- -------- -------- ------ ---------------------
Index ANY ANY ANY /
Accueil ANY ANY ANY /Accueil
HelloName ANY ANY ANY /hello-world/{name}
Reprog ANY ANY ANY /Reprog
NosVoitures ANY ANY ANY /NosVoitures
Contact ANY ANY ANY /Contact
Services ANY ANY ANY /Services
请求HTTP:
[02 / Feb / 2020:09:18:37 -0500]“ GET / Reprog HTTP / 1.1” 404 204“ http://jw-motorsport.fr”“ Mozilla / 5.0(Windows NT 6.1; Win64; x64; rv: 72.0)Gecko / 20100101 Firefox / 72.0“
答案 0 :(得分:0)
我遇到了同样的问题,.htaccess
文件似乎有问题(如果没有的话)。如果您查看关于Apache Configuring a Web Server的Symfony文档,它具有禁用.htaccess
的优化配置,请尝试像这样调整您的VirtualHost配置:
<VirtualHost *:80>
ServerName domain.tld
ServerAlias www.domain.tld
DocumentRoot /var/www/project/public
DirectoryIndex /index.php
<Directory /var/www/project/public>
AllowOverride None
Order Allow,Deny
Allow from All
FallbackResource /index.php
</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 fallback resource for the asset directories
# which will allow Apache to return a 404 error when files are
# not found instead of passing the request to Symfony
<Directory /var/www/project/public/bundles>
FallbackResource disabled
</Directory>
ErrorLog /var/log/apache2/project_error.log
CustomLog /var/log/apache2/project_access.log combined
# optionally set the value of the environment variables used in the application
#SetEnv APP_ENV prod
#SetEnv APP_SECRET <app-secret-id>
#SetEnv DATABASE_URL "mysql://db_user:db_pass@host:3306/db_name"
</VirtualHost>
希望有帮助!