[Elastic Beanstalk] Nginx configuration is not being copied to /etc/nginx

1

As the title sais, the configuration files of nginx are not being copied from /var/proxy/staging to /etc/nginx as it should (maybe?). I have followed the documentation about overwritiing the default nginx conf, so this is my bundle tree:

app_root/
├─ .platform/
│  ├─ nginx/
│  │  ├─ nginx.conf
│  │  ├─ conf.d/
│  │  │  ├─ my_custom_conf.conf

Unfortunantely the files are copied to /var/proxy/staging and not copied to /etc/nginx. The configuration file is correct (I also manually copied to /etc/nginx and restarted the webserver and it works). If I press "environment rebuild" from the beanstalk console, the new instance won't even start nginx automatically. I had to make another postdeploy script to move the files and restart nginx. In the eb-engine.log logs there's nothing beside the copy command:

Running command /bin/sh -c cp -rp /var/app/staging/.platform/nginx/. /var/proxy/staging/nginx

I have other applications where this works fine. I can't find the solution.

profile picture
floro
질문됨 2년 전1032회 조회
1개 답변
1

Hello,

Thank you for posting your query on re:Post. As I understand, you are facing issue configuring the Nginx proxy, however the changes are not copying to the desired location.

As per the directory structure is concerned, the one you mentioned seems correct to me. Based on the documentation, the .platform directory should be at the root of the source bundle.

[] Extending Elastic Beanstalk Linux platforms - https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/platforms-linux-extend.html

Now, since this is working on other applications, there is something specific to your current application which is causing the issue. Therefore, is it possible for you reach out to AWS Support via the support case (for privacy concerns) for further troubleshooting on the issue.

Please share the complete bundle logs, details of the environment like environment name or id. for more insights.

Further on the copy command, the command is executed after the nginx configuration is validated. Please refer the below logs for my replication.

2022/09/12 14:32:07.721209 [INFO] Executing instruction: start proxy with new configuration

2022/09/12 14:32:07.721232 [INFO] Running command /bin/sh -c /usr/sbin/nginx -t -c /var/proxy/staging/nginx/nginx.conf

2022/09/12 14:32:07.731058 [INFO] nginx: the configuration file /var/proxy/staging/nginx/nginx.conf syntax is ok

nginx: configuration file /var/proxy/staging/nginx/nginx.conf test is successful

2022/09/12 14:32:07.731356 [INFO] Running command /bin/sh -c cp -rp /var/proxy/staging/nginx/* /etc/nginx

Therefore, can you please check if in the logs you are getting anything apart from the log entry you mentioned.

Hoping that the above helps. Thank you.

AWS
지원 엔지니어
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠