Skip to content

Commit

Permalink
Merge pull request #11 from solidbunch/fix-fastcgi-logging
Browse files Browse the repository at this point in the history
improve php logging configuration, fix nginx buffer error
  • Loading branch information
yuriipavlov authored Oct 5, 2024
2 parents 8af0422 + f262cc7 commit f63b00b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
12 changes: 11 additions & 1 deletion config/nginx/config/common.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
include /etc/nginx/conf.d/config/partials/php.conf;
}

# Allow all REST API requests
location ~ ^/wp-json/ {
try_files $uri $uri/ /index.php?$args;
}

# Robots.txt
location ~ ^/robots.txt {
expires off;
Expand All @@ -57,6 +62,11 @@
return 404;
}

# Close main theme screenshot.png
location ~* ^/wp-content/themes/${WP_DEFAULT_THEME}/screenshot\.png$ {
return 404;
}

# Process all allowed static files including images, fonts, media, documents, etc.
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|webp|avif|bmp|tiff|mp3|mp4|ogg|wav|webm|pdf|doc|docx|ppt|pptx|xls|xlsx|zip|rar|7z|woff|woff2|ttf|otf|eot)$ {
expires max;
Expand All @@ -74,7 +84,7 @@
}

# Deny access to all other files
location ~* \.(.*)$ {
location ~* /[^/]*\.[^/]*$ {
return 404;
}

Expand Down
7 changes: 5 additions & 2 deletions config/nginx/config/partials/php.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
location ~ \.php$ {
try_files $uri =404;
fastcgi_intercept_errors on;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# Forward to php-fpm container
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;

# Increase the buffer if there are overflow problems
#fastcgi_buffer_size 16k;
#fastcgi_buffers 16 16k;
#fastcgi_busy_buffers_size 32k;
}

4 changes: 2 additions & 2 deletions config/php/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ ignore_repeated_errors = On
; is On you will not log errors with repeated messages from different files or
; source lines.
; https://php.net/ignore-repeated-source
ignore_repeated_source = Off
ignore_repeated_source = On

; If this parameter is set to Off, then memory leaks will not be shown (on
; stdout or in the log). This is only effective in a debug compile, and if
Expand Down Expand Up @@ -823,7 +823,7 @@ enable_dl = Off

; Disable logging through FastCGI connection. PHP's default behavior is to enable
; this feature.
;fastcgi.logging = 0
fastcgi.logging = 0

; cgi.rfc2616_headers configuration option tells PHP what type of headers to
; use when sending HTTP response code. If set to 0, PHP sends Status: header that
Expand Down

0 comments on commit f63b00b

Please sign in to comment.