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!

Ron
질문됨 2년 전742회 조회
1개 답변
2

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!

Ron
답변함 2년 전
  • You could mark your answer as 'accepted' to indicate this question has a solution.

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

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

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

관련 콘텐츠