Uma maneira de fazer isso é criar um arquivo e incluí-lo. Por exemplo, crie um novo arquivo chamado 'standard_include.conf', com o seguinte texto.
proxy_pass http://127.0.0.1:9010;
error_page 413 =200 https://my.website.com/errors/413;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Depois, tenha sua configuração padrão como:
#listen [::]:443 ipv6only=on; ## listen for ipv6
listen 443;
server_name my.website.com;
access_log /var/log/nginx/my.website.com_access.log;
error_log /var/log/nginx/my.website.com_error.log;
ssl on;
ssl_certificate /etc/nginx/website.com/cert.pem;
ssl_certificate_key /etc/nginx/website.com/cert.key;
ssl_session_timeout 5m;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP:!kEDH;
ssl_prefer_server_ciphers on;
location / {
include standard_include.conf;
client_max_body_size 1m; # I limit all the file upload to 1 Mo
}
# Now, for the two next locations, I will change the body size to 10Mo
location = /picture/create {
include standard_include.conf;
client_max_body_size 10m; # Here,
}
location ^/picture/([0-9]+)/edit$ {
include standard_include.conf;
client_max_body_size 10m; # And here
}