From cbb1d79584227880d41533e4c14c69eb84d740a1 Mon Sep 17 00:00:00 2001 From: Alex Prokopenko Date: Tue, 16 Nov 2021 21:35:03 +0300 Subject: [PATCH] + webp octobercms support --- .env.example | 1 + config/nginx/includes.d/octobercms.conf | 21 ++++++++++----------- config/nginx/includes.d/staticfiles.conf | 14 +++++++++++++- docker-compose.base.yml | 1 + dockerfiles/php-fpm/php73.Dockerfile | 3 +++ dockerfiles/php-fpm/xdebug.ini | 1 + 6 files changed, 29 insertions(+), 12 deletions(-) diff --git a/.env.example b/.env.example index 2b83161..a1c2290 100644 --- a/.env.example +++ b/.env.example @@ -14,6 +14,7 @@ INSTALL_PEAR_MAIL=true PHP_OPT_SHORT_OPEN_TAG=On PHP_OPT_MAX_EXECUTION_TIME=600 PHP_OPT_MEMORY_LIMIT=500M +PHP_OPT_POST_MAX_SIZE=200M PHP_OPT_UPLOAD_MAX_FILESIZE=20M ### MINIO S3 ############################################# diff --git a/config/nginx/includes.d/octobercms.conf b/config/nginx/includes.d/octobercms.conf index 3b72131..d3d5e32 100644 --- a/config/nginx/includes.d/octobercms.conf +++ b/config/nginx/includes.d/octobercms.conf @@ -6,20 +6,20 @@ rewrite ^/.*$ /index.php last; expires max; } + # Whitelist ## Let October handle if static file not exists - location ~ ^/favicon\.ico { try_files $uri /index.php; } - location ~ ^/sitemap\.xml { try_files $uri /index.php; } - location ~ ^/robots\.txt { try_files $uri /index.php; } - location ~ ^/humans\.txt { try_files $uri /index.php; } + location = /favicon.ico { try_files $uri /index.php; } + location = /sitemap.xml { try_files $uri /index.php; } + location = /robots.txt { try_files $uri /index.php; } + location = /humans.txt { try_files $uri /index.php; } ## Let nginx return 404 if static file not exists - location ~ ^/storage/app/uploads/public { try_files $uri /404; } - location ~ ^/storage/app/media { try_files $uri /404; } - location ~ ^/storage/app/yml { try_files $uri /404; } - location ~ ^/files { try_files $uri /404; } - location ~ ^/storage/app/.*\.xls { try_files $uri /404; } - location ~ ^/storage/temp/public { try_files $uri /404; } + #location /storage/app/uploads/public { try_files $uri /404; } + #location /storage/app/media { try_files $uri /404; } + #location /storage/app/yml { try_files $uri /404; } + location /storage/app/resized { try_files $uri /404; } + #location /storage/temp/public { try_files $uri /404; } location ~ ^/modules/.*/assets { try_files $uri /404; } location ~ ^/modules/.*/resources { try_files $uri /404; } @@ -48,5 +48,4 @@ access_log off; expires max; } - location ~ ^/themes/.*/semantic { try_files $uri /404; } location ~ ^/themes/.*/resources { try_files $uri /404; } diff --git a/config/nginx/includes.d/staticfiles.conf b/config/nginx/includes.d/staticfiles.conf index 3c471c9..dfa5e64 100644 --- a/config/nginx/includes.d/staticfiles.conf +++ b/config/nginx/includes.d/staticfiles.conf @@ -1,5 +1,17 @@ #rewrite "^(.*)\.(\d{10})\.(css|js)$" $1.$3 break; -location ~* \.(jpg|jpeg|gif|png|svg|ico)$ { +location ~* \.(gif|svg|ico)$ { + access_log off; + expires max; + log_not_found off; + error_page 404 = /empty; +} +location ~* \.jpge?g$ { + access_log off; + expires max; + log_not_found off; + error_page 404 = /empty; +} +location ~* \.png$ { access_log off; expires max; log_not_found off; diff --git a/docker-compose.base.yml b/docker-compose.base.yml index e418a73..882c226 100755 --- a/docker-compose.base.yml +++ b/docker-compose.base.yml @@ -23,6 +23,7 @@ services: - PHP_OPT_SHORT_OPEN_TAG=${PHP_OPT_SHORT_OPEN_TAG} - PHP_OPT_MAX_EXECUTION_TIME=${PHP_OPT_MAX_EXECUTION_TIME} - PHP_OPT_MEMORY_LIMIT=${PHP_OPT_MEMORY_LIMIT} + - PHP_OPT_POST_MAX_SIZE=${PHP_OPT_POST_MAX_SIZE} - PHP_OPT_UPLOAD_MAX_FILESIZE=${PHP_OPT_UPLOAD_MAX_FILESIZE} restart: always volumes: diff --git a/dockerfiles/php-fpm/php73.Dockerfile b/dockerfiles/php-fpm/php73.Dockerfile index 27e05b3..309ac35 100644 --- a/dockerfiles/php-fpm/php73.Dockerfile +++ b/dockerfiles/php-fpm/php73.Dockerfile @@ -45,5 +45,8 @@ RUN sed -i "s/^max_execution_time = .*/max_execution_time = $PHP_OPT_MAX_EXECUTI ARG PHP_OPT_MEMORY_LIMIT=128M RUN sed -i "s/^memory_limit = .*/memory_limit = $PHP_OPT_MEMORY_LIMIT/g" "$PHP_INI_DIR/php.ini" +ARG PHP_OPT_MEMORY_LIMIT=128M +RUN sed -i "s/^post_max_size = .*/post_max_size = $PHP_OPT_POST_MAX_SIZE/g" "$PHP_INI_DIR/php.ini" + ARG PHP_OPT_UPLOAD_MAX_FILESIZE=2M RUN sed -i "s/^upload_max_filesize = .*/upload_max_filesize = $PHP_OPT_UPLOAD_MAX_FILESIZE/g" "$PHP_INI_DIR/php.ini" diff --git a/dockerfiles/php-fpm/xdebug.ini b/dockerfiles/php-fpm/xdebug.ini index 25c1f50..579d2f6 100644 --- a/dockerfiles/php-fpm/xdebug.ini +++ b/dockerfiles/php-fpm/xdebug.ini @@ -23,3 +23,4 @@ xdebug.trace_enable_trigger=1 xdebug.trace_output_dir=/tmp xdebug.trace_output_name="trace.%t" +xdebug.show_exception_trace=0 \ No newline at end of file