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
gefragt vor 2 Jahren742 Aufrufe
1 Antwort
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
beantwortet vor 2 Jahren
  • You could mark your answer as 'accepted' to indicate this question has a solution.

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen