-
-
Save sanjmen/509fa07b4b2fc573b83ef65914e992e0 to your computer and use it in GitHub Desktop.
Optimized nginx configuration for an AWS Elastic Beanstalk environment using an Application Load Balancer.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
files: | |
"/opt/elasticbeanstalk/#etc#nginx#optimized-nginx.conf": | |
mode: "000644" | |
owner: root | |
group: root | |
encoding: plain | |
content: | | |
# Elastic Beanstalk Managed | |
# Elastic Beanstalk managed configuration file | |
# Some configuration of nginx can be by placing files in /etc/nginx/conf.d | |
# using Configuration Files. | |
# http://docs.amazonwebservices.com/elasticbeanstalk/latest/dg/customize-containers.html | |
# | |
# Modifications of nginx.conf can be performed using container_commands to modify the staged version | |
# located in /tmp/deployment/config/etc#nginx#nginx.conf | |
# THIS FILE HAS BEEN MODIFIED BY AN `.ebextensions` SCRIPT | |
user nginx; | |
worker_processes 1; | |
error_log /var/log/nginx/error.log; | |
pid /var/run/nginx.pid; | |
worker_rlimit_nofile 65536; | |
events { | |
worker_connections 8192; | |
use epoll; | |
} | |
http { | |
client_max_body_size 100m; | |
port_in_redirect off; | |
include /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | |
'$status $body_bytes_sent "$http_referer" ' | |
'"$http_user_agent" "$http_x_forwarded_for" ' | |
'$request_time $upstream_response_time'; | |
access_log /var/log/nginx/access.log main; | |
sendfile on; | |
keepalive_timeout 65; | |
# Elastic Beanstalk Modification(EB_INCLUDE) | |
log_format healthd '$msec"$uri"' | |
'$status"$request_time"$upstream_response_time"' | |
'$http_x_forwarded_for'; | |
include /etc/nginx/conf.d/*.conf; | |
# End Modification | |
} | |
"/etc/security/limits.conf": | |
mode: "000644" | |
encoding: plain | |
owner: root | |
group: root | |
content: | | |
# THIS FILE HAS BEEN MODIFIED BY AN `.ebextensions` SCRIPT | |
nginx soft nofile 65535 | |
nginx hard nofile 65535 | |
container_commands: | |
01-mv: | |
command: "mv -f /opt/elasticbeanstalk/#etc#nginx#optimized-nginx.conf /tmp/deployment/config/#etc#nginx#nginx.conf" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment