Mishu
Mishu

Reputation: 269

How to customize nginx config on Node.js Elastic Beanstalk

I'm new to AWS EBS. I'm trying to modify etc/nginx/nginx.conf. I just wanted to add a line in http{ underscores_in_headers on; } and I'm able to change by accessing the instance with IP using putty. But the problem is that when auto scaling scales the environment with new IP then the line http{ underscores_in_headers on; } will be removed from new instance.

So, I want when server deploy new snapshot/instance has to be similar as the main server or you can say with same configuration.

I tried to solve my issue with this link

Upvotes: 4

Views: 3006

Answers (2)

Prateek218
Prateek218

Reputation: 664

Step 1 To edit the configuration in AWS ElasticBean of nginx you need to add the configuration file in .ebextensions

to this add folder .ebextensions/nginx/ create proxy.config file

files:
  /etc/nginx/conf.d/proxy.conf:
    mode: "000644"
    owner: root
    group: root
    content: |
      underscores_in_headers on;

it will start accepting header with underscores.

Step 2

In case if it not accepting header with underscores then access your instance with ssh and run the following command.

sudo service nginx reload

Hope it helps.

Upvotes: 1

LoopBoi
LoopBoi

Reputation: 453

stack isn't letting me comment because I'm a noobie. Prateek really helped out, just one small modification to his solution for the proxy.config file and it should work! Don't forget to indent /etc/nginx/conf.d/proxy.conf: as well! Further info here: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/nodejs-platform-proxy.html

files:
  /etc/nginx/conf.d/proxy.conf:
    mode: "000644"
    owner: root
    group: root
    content: |
      underscores_in_headers on;

Upvotes: 0

Related Questions