How to find my current nginx.conf file from the AWS EC2 Enviroment
Question:
I need to modify nginx.conf to increase client_max_body_size
. On the AWS docs . Here they are giving an example of how to modify the configuration . but they are doing a lot more things that I don’t want to do that.
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/java-se-nginx.html
user nginx;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
worker_processes auto;
worker_rlimit_nofile 33282;
events {
worker_connections 1024;
}
http {
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"';
include conf.d/*.conf;
map $http_upgrade $connection_upgrade {
default "upgrade";
}
server {
listen 80 default_server;
root /var/app/current/public;
location / {
}git pull
location /api {
proxy_pass http://127.0.0.1:5000;
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;
}
access_log /var/log/nginx/access.log main;
client_header_timeout 60;
client_body_timeout 60;
keepalive_timeout 60;
gzip off;
gzip_comp_level 4;
# Include the Elastic Beanstalk generated locations
include conf.d/elasticbeanstalk/01_static.conf;
include conf.d/elasticbeanstalk/healthd.conf;
}
}
I need your help to decide what I have to put into that file so my other settings won’t get affected. I pushed the code using elastic beanstalk and it running on the default python environment since then. So anyway to find my current nginx.conf
file.
Answers:
You don’t need to overwrite entire nginx.conf for that. As explained in the Reverse proxy configuration docs you can just create .platform/nginx/conf.d/myconfig.conf
file in your deployment package with the content of, e.g.:
client_max_body_size 10M;
I need to modify nginx.conf to increase client_max_body_size
. On the AWS docs . Here they are giving an example of how to modify the configuration . but they are doing a lot more things that I don’t want to do that.
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/java-se-nginx.html
user nginx;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
worker_processes auto;
worker_rlimit_nofile 33282;
events {
worker_connections 1024;
}
http {
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"';
include conf.d/*.conf;
map $http_upgrade $connection_upgrade {
default "upgrade";
}
server {
listen 80 default_server;
root /var/app/current/public;
location / {
}git pull
location /api {
proxy_pass http://127.0.0.1:5000;
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;
}
access_log /var/log/nginx/access.log main;
client_header_timeout 60;
client_body_timeout 60;
keepalive_timeout 60;
gzip off;
gzip_comp_level 4;
# Include the Elastic Beanstalk generated locations
include conf.d/elasticbeanstalk/01_static.conf;
include conf.d/elasticbeanstalk/healthd.conf;
}
}
I need your help to decide what I have to put into that file so my other settings won’t get affected. I pushed the code using elastic beanstalk and it running on the default python environment since then. So anyway to find my current nginx.conf
file.
You don’t need to overwrite entire nginx.conf for that. As explained in the Reverse proxy configuration docs you can just create .platform/nginx/conf.d/myconfig.conf
file in your deployment package with the content of, e.g.:
client_max_body_size 10M;