我已经坚持了一段时间。我们有一个Symfony 2.8项目,我想将其部署到云中。我已经正确创建了ElasticBeanstalk环境,它可以正常工作!但是我仍然需要访问http://domain/app.php才能使其正常工作。我设法从URL删除了web /更改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/9https://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中。
任何想法?
您可以尝试一些方法。
https://symfony.com/doc/2.8/setup/web_server_configuration.html#nginx
在这里您可以找到项目的配置。在那里,您可以看到该位置已被重写为app.php
。
location ~ ^/(app_dev|config)\.php(/|$) {
所以我建议采取配置并进行测试。
使用index
nginx指令将app.php
设置为http://domain/
请求的默认处理程序:
server {
...
index app.php;
# your locations here
}