By using AWS re:Post, you agree to the Terms of Use
/Elastic Beanstalk | .Net with Docker containg custon nginx.conf/

Elastic Beanstalk | .Net with Docker containg custon nginx.conf

0

Current Setup: Elastic Beanstalk running Docker running on 64bit Amazon Linux 2/3.4.11.

I was trying to follow AWS Guidelines for overwrite nginx.conf file located in /etc/nginx/nginx.conf without any success. I have .NET 5 project containing the .platform/nginx/nginx.conf (also trying .ebextenstion). When I'm building my dockerfile and deploying to ECR, adding dockerrun.aws.json to pull the latest image its not taking my custom nginx.conf.

nginx.file:


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

events {
 worker_connections  4096;
}

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

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


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;
gzip on;
gzip_comp_level 4;
  gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

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

  location / {
proxy_pass    http://docker;
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;
}

# Include the Elastic Beanstalk generated locations
include conf.d/elasticbeanstalk/*.conf;
}
}

I would like to know how can I fix it and replace the nginx default file.

Thanks!

asked 3 months ago78 views
1 Answers
1

Found the Solution. I working with dockerrun.aws.json v3 so I just created a zip file that contain the dockerrun.aws.json + folder ./platform/nginx and now its working!

answered 3 months ago
  • You could mark your answer as 'accepted' to indicate this question has a solution.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions