From b42c99ea94de043fc997da2e08a0e6c4bba9e1c1 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Tue, 23 Jun 2020 13:06:07 +0300 Subject: [PATCH] Dynamic nginx max request size --- Dockerfile | 3 +-- bin/start | 2 ++ docker-compose.yml | 1 - docker/{nginx.conf => nginx.conf.template} | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename docker/{nginx.conf => nginx.conf.template} (98%) diff --git a/Dockerfile b/Dockerfile index c4e7e72c82..8a86a910fc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -130,13 +130,12 @@ RUN \ # Set Upload Limit (default to 100MB) RUN echo "upload_max_filesize = ${_APP_STORAGE_LIMIT}" >> /etc/php/$PHP_VERSION/fpm/conf.d/appwrite.ini RUN echo "post_max_size = ${_APP_STORAGE_LIMIT}" >> /etc/php/$PHP_VERSION/fpm/conf.d/appwrite.ini -RUN echo "env[TESTME] = your-secret-key" >> /etc/php/$PHP_VERSION/fpm/conf.d/appwrite.ini # Add logs file RUN echo "" >> /var/log/appwrite.log # Nginx Configuration (with self-signed ssl certificates) -COPY ./docker/nginx.conf /etc/nginx/nginx.conf +COPY ./docker/nginx.conf.template /etc/nginx/nginx.conf.template COPY ./docker/ssl/cert.pem /etc/nginx/ssl/cert.pem COPY ./docker/ssl/key.pem /etc/nginx/ssl/key.pem diff --git a/bin/start b/bin/start index 931aa101f6..4b0616978e 100755 --- a/bin/start +++ b/bin/start @@ -4,6 +4,8 @@ export PHP_VERSION=$PHP_VERSION chown -Rf www-data.www-data /usr/share/nginx/html/ +sed 's/%_APP_STORAGE_LIMIT%/'$_APP_STORAGE_LIMIT'/g' /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf + # Function to update the fpm configuration to make the service environment variables available function setEnvironmentVariable() { if [ -z "$2" ]; then diff --git a/docker-compose.yml b/docker-compose.yml index ae7c46ed85..26a2ed016f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -54,7 +54,6 @@ services: - ./docs:/usr/share/nginx/html/docs - ./public:/usr/share/nginx/html/public - ./src:/usr/share/nginx/html/src - - ./docker/nginx.conf:/etc/nginx/nginx.conf depends_on: - mariadb - redis diff --git a/docker/nginx.conf b/docker/nginx.conf.template similarity index 98% rename from docker/nginx.conf rename to docker/nginx.conf.template index 7b62ec9a5b..f0f748d943 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf.template @@ -16,7 +16,7 @@ http { tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; - client_max_body_size 10M; + client_max_body_size %_APP_STORAGE_LIMIT%; # server_names_hash_bucket_size 64; # server_name_in_redirect off;