我已经坚持了一段时间。我们有一个 Symfony 2.8 项目,我想将它部署到云端。我已经正确创建了 ElasticBeanstalk 环境并且它可以工作!但我仍然需要访问http://domain/app.php才能使其正常工作。我设法从 URL 中删除了 web/changing documentDirectory 部分,但 app.php 仍然存在。
我还尝试了一个新的品牌项目: https://docs.aws.amazon.com/es_es/elasticbeanstalk/latest/dg/php-symfony-tutorial.html 但是当我将其更改为 public/ 时发生在我身上同样我需要在 URL 中使用 index.php
我修改了 NGINX conf 如下: https://community.bitnami.com/t/how-to-change-default-root/65639/9 https://symfony.com/doc/current/setup/web_server_configuration.html
这是我添加到 /etc/nginx/nginx.conf.default
location / {
try_files $uri $uri/ /app.php$is_args$args;
}
location ~ \.php$ {
try_files $uri $uri/ =404;
fastcgi_pass unix:/var/run/php-fpm/www.sock;
fastcgi_index app.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
我已经使用重新启动 nginx 服务
sudo service nginx restart
但它保持不变。
为了以防万一,我还尝试将 app.php 重命名为 index.php。但是我需要将 /index.php 添加到 URL。
任何想法?
牛魔王的故事
皈依舞