使用.platform的AWS Elasticbeanstalk覆盖Nginx配置不起作用 [英] AWS Elasticbeanstalk overriding Nginx config using .platform is not working

查看:69
本文介绍了使用.platform的AWS Elasticbeanstalk覆盖Nginx配置不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将Laravel应用程序部署到AWS ElasticBeanstalk.我已经部署了.现在,我试图覆盖"/etc/nginx/conf.d/elasticbeanstalk/php.conf";.platform文件夹中保存文件.

I am deploying my Laravel application to AWS ElasticBeanstalk. I have deployed it. Now, I am trying to override "/etc/nginx/conf.d/elasticbeanstalk/php.conf" file using .platform folder.

我在项目的根文件夹中直接创建了.platform/etc/nginx/conf.d/elasticbeanstalk/php.conf文件.然后输入配置内容.

I created .platform/etc/nginx/conf.d/elasticbeanstalk/php.conf file right inside the project's root folder. Then I put in the configuration content.

然后,我部署我的应用程序,执行"be deploy".命令.但是Nginx配置文件不会被覆盖.我的配置有什么问题,如何使它正常工作?

Then I deploy my application executing "be deploy" command. But the Nginx config file is not overridden. What is wrong with my config and how can I get it working?

我也尝试使用.ebextensions创建具有以下内容的配置文件.该文件不只是创建的.

I tried using .ebextensions too creating a config file with the following content. The file is not just created.

files:
  /etc/nginx/conf.d/elasticbeanstalk/laravel.conf:
    mode: "000755"
    owner: root
    group: root
    content: |
      location / {
            try_files $uri $uri/ /index.php?$query_string;
            gzip_static on;
      }

推荐答案

您要设置的 nginx 配置文件在 Amazon Linux 1 (AL1)中使用.

The nginx config file you are trying to set is used in Amazon Linux 1 (AL1).

对于AL2,应提供 nginx 配置文件(

For AL2, the nginx config files should be provided (aws docs) using:

  • .platform/nginx/conf.d/

或者如果您想覆盖主要的 nginx 配置文件,请使用

or if you want to overwrite main nginx config file, use

  • .platform/nginx/nginx.conf

因此,您可以尝试使用以下内容的以下文件 .platform/nginx/conf.d/laravel.conf :

Thus, you can try the following file .platform/nginx/conf.d/laravel.conf with content of:

location / {
      try_files $uri $uri/ /index.php?$query_string;
      gzip_static on;
}

如果它不起作用,则可以检查/var/log 或nginx config文件夹中的nginx日志,以检查该文件是否正确放置在nginx config文件夹中.

If it does not work, you can inspect nginx logs in /var/log or nginx config folder to check if the file is correctly placed in nginx config folder.

Solution I used

我使用了它,而且效果很好. .platform/nginx/conf.d/elasticbeanstalk/laravel.conf

I used this and it worked. .platform/nginx/conf.d/elasticbeanstalk/laravel.conf

这篇关于使用.platform的AWS Elasticbeanstalk覆盖Nginx配置不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆