# Ignore 4xx errors which we get a bunch of those in # the file browser version switcher - e.g. when viewing the # README.md file of version 1.0.0, there are links to the # same file in other versions, but it may be absent, thus # a 404 error. # We don't want elastic beanstalk replace instances because # of those 404 errors. # See https://stackoverflow.com/a/49606726/267998 files: "/tmp/custom-site-nginx.conf": mode: "000664" owner: root group: root content: | map $http_upgrade $connection_upgrade { default "upgrade"; "" ""; } # Elastic Beanstalk Modification(EB_INCLUDE) # Custom config # HTTP 4xx ignored. map $status $loggable { ~^[4] 0; default 1; } server { listen 80; gzip on; gzip_comp_level 4; gzip_types text/html text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript; if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})T(\d{2})") { set $year $1; set $month $2; set $day $3; set $hour $4; } access_log /var/log/nginx/healthd/application.log.$year-$month-$day-$hour healthd if=$loggable; access_log /var/log/nginx/access.log; 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; } } container_commands: override_beanstalk_nginx: command: "mv -f /tmp/custom-site-nginx.conf /etc/nginx/sites-available/elasticbeanstalk-nginx-docker-proxy.conf"