如何从 AWS EC2 环境中查找我当前的 nginx.conf 文件

atr*_*ona 1 python nginx amazon-web-services amazon-elastic-beanstalk

我需要修改nginx.conf来增加client_max_body_size . 在 AWS 文档上。这里他们给出了如何修改配置的示例。但他们做了很多我不想做的事情。

https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/java-se-nginx.html

user                    nginx;
error_log               /var/log/nginx/error.log warn;
pid                     /var/run/nginx.pid;
worker_processes        auto;
worker_rlimit_nofile    33282;

events {
    worker_connections  1024;
}

http {
  include       /etc/nginx/mime.types;
  default_type  application/octet-stream;

  log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                    '$status $body_bytes_sent "$http_referer" '
                    '"$http_user_agent" "$http_x_forwarded_for"';

  include       conf.d/*.conf;

  map $http_upgrade $connection_upgrade {
      default     "upgrade";
  }

  server {
      listen        80 default_server;
      root /var/app/current/public;

      location / {
      }git pull
      

      location /api {
          proxy_pass          http://127.0.0.1:5000;
          proxy_http_version  1.1;

          proxy_set_header    Connection          $connection_upgrade;
          proxy_set_header    Upgrade             $http_upgrade;
          proxy_set_header    Host                $host;
          proxy_set_header    X-Real-IP           $remote_addr;
          proxy_set_header    X-Forwarded-For     $proxy_add_x_forwarded_for;
      }

      access_log    /var/log/nginx/access.log main;

      client_header_timeout 60;
      client_body_timeout   60;
      keepalive_timeout     60;
      gzip                  off;
      gzip_comp_level       4;

      # Include the Elastic Beanstalk generated locations
      include conf.d/elasticbeanstalk/01_static.conf;
      include conf.d/elasticbeanstalk/healthd.conf;
  }
}
Run Code Online (Sandbox Code Playgroud)

我需要您的帮助来决定我必须将哪些内容放入该文件中,以便我的其他设置不会受到影响。我使用 elastic beanstalk 推送了代码,从那时起它就在默认的 python 环境中运行。所以无论如何要找到我当前的nginx.conf文件。

Mar*_*cin 6

您不需要为此覆盖整个 nginx.conf。正如反向代理配置文档中所述,您可以.platform/nginx/conf.d/myconfig.conf在部署包中创建包含以下内容的文件,例如:

client_max_body_size 10M;
Run Code Online (Sandbox Code Playgroud)