Nginx config file overwritten during Elastic Beanstalk deployment?

前端 未结 6 2095
自闭症患者
自闭症患者 2020-11-29 04:52

I need to add p3p headers to the static resource location on a standard Nodejs & Nginx Elastic Beanstalk.

I\'ve created an ebextension script as exp

6条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-29 05:34

    As of this writing, the proper way to update/add values into the http config in the nginx.conf file without overwriting it is to add a .config file to the .ebextensions folder that looks like this:

    files:
      "/etc/nginx/conf.d/custom_nginx.conf":
        content: |
    
          proxy_connect_timeout       600;
          proxy_send_timeout          600;
          proxy_read_timeout          600;
          send_timeout                600;
    

    This creates a new file called custom_nginx.conf in the /etc/nginx/conf.d directory. Since the nginx.conf file contains

    http {
      include       /etc/nginx/conf.d/*.conf;
    }
    

    when the server is started it will pull the 4 timeout vars from custom_nginx.conf into the http section of nginx.conf

提交回复
热议问题