得到“在此服务器上未找到所请求的URL。”当我在AWS EC2中托管Symfony4项目时出现错误

问题描述 投票:-1回答:1

我使用Symfony 4创建了一个项目,它在我的本地环境中运行良好。然后,我将项目托管在AWS EC2中,并且项目安装完美。然后,我访问根目录,index.php文件运行正常,并且显示了symfony 4欢迎页面。

但是当我尝试转到其他URL时,它给我以下404错误。

The requested URL was not found on this server.Apache/2.4.18 (Ubuntu) Server at 52.221.55.155 Port 80

我无法转到routes.yaml文件中定义的任何路由。但是asease路由在我的本地环境中可以正常工作。

下面是我使用的.conf文件。

<VirtualHost *:80>
    ServerName 52.221.55.155
    DocumentRoot /var/www/html/oenele-dev-team-server-side/public/
    ErrorLog ${APACHE_LOG_DIR}/oenele-dev-team-server-side-error.log
    CustomLog ${APACHE_LOG_DIR}/oenele-dev-team-server-side-access.log combined
    <Directory "/webhost/public/index.php">
        allow from all
    </Directory>
</VirtualHost>

[请帮助我解决这个问题。

非常感谢。

apache amazon-web-services amazon-ec2 symfony4
1个回答
0
投票

我在这里找到了问题。问题出在我的.conf文件中。我将其更改如下,现在可以正常使用。

<VirtualHost *:80>
    ServerName 52.221.55.155
    DocumentRoot /var/www/html/oenele-dev-team-server-side/public/
    ErrorLog ${APACHE_LOG_DIR}/oenele-dev-team-server-side-error.log
    CustomLog ${APACHE_LOG_DIR}/oenele-dev-team-server-side-access.log combined
    SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
    <Directory /var/www/html/oenele-dev-team-server-side/public/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

© www.soinside.com 2019 - 2024. All rights reserved.