Closed mrnoisytiger closed 1 month ago
No need to modify the image. To modify files shipped in it, you will want to grab a copy of the file in question (found here), modify it, and attach it to the original location (/etc/nginx/nginx.conf) into the image. In UNIX and Linux you can mount over single files or directories as many times as needed, though normally this not done, since it wastes space (two versions of the file).
The only downside is that you may occasionally have to update the config file, should a new nginx change the config format or some of the core default settings provided in it (the same is true for our project, since we replace the version shipped by alpine).
Alternatively, you may want to have a look at the sister image that uses nginx unit instead of the nginx webserver. It's single configuration file for unit and PHP is found here. You would want to change the max_body_size as well as the two PHP settings post_max_size and upload_max_filesize and can either do so by attaching your own version into the image as /var/lib/unit/conf.json or using the configuration socket in the image at /run/control.unit.sock to push configuration changes at runtime (useful to test changes without restarting the service) - see also the section in the readme doc.
I'm trying to increase my
client_max_body_size
by following the guidance in the README. I've added a newclient_max_body_size
directive and have it mounted as read-only to into the/etc/nginx/http.d/
folder asnginx.conf
.However, upon starting the Docker container, I get the following error:
This appears to be due to the same max size directive being set in the main
/etc/nginx/nginx.conf
but also repeated in the additional config. Would love to know how best to solve this without tinkering with the base filesystem files.