90 lines
2.7 KiB
Text
90 lines
2.7 KiB
Text
### common directives and settings
|
|
|
|
index index.html index.php;
|
|
|
|
# Ref: https://gist.github.com/magnetikonline/11312172
|
|
fastcgi_buffers 32 32k;
|
|
fastcgi_buffer_size 32k;
|
|
|
|
proxy_buffers 8 32k;
|
|
proxy_buffer_size 64k;
|
|
# -------------------------------------------------------------------
|
|
|
|
# for time-consuming operations (such as WP import or file upload)
|
|
# https://nginx.org/r/fastcgi_read_timeout
|
|
# default 60 seconds
|
|
fastcgi_read_timeout 5m;
|
|
|
|
# -------------------------------------------------------------------
|
|
|
|
### To enable large uploads
|
|
# Please make sure the corresponding PHP values are increased as well
|
|
# post_max_size = 8M (default)
|
|
# upload_max_filesize = 2M (default)
|
|
|
|
client_max_body_size 2G;
|
|
|
|
# -------------------------------------------------------------------
|
|
|
|
### To fix the error - could not build the server_names_hash
|
|
# ref: https://nginx.org/en/docs/hash.html
|
|
server_names_hash_bucket_size 128;
|
|
|
|
# -------------------------------------------------------------------
|
|
|
|
# for extended metrics (in Amplify, etc)
|
|
log_format main_ext '$remote_addr - $remote_user [$time_local] "$request" '
|
|
'$status $body_bytes_sent "$http_referer" '
|
|
'"$http_user_agent" "$http_x_forwarded_for" '
|
|
'"$host" sn="$server_name" '
|
|
'rt=$request_time '
|
|
'ua="$upstream_addr" us="$upstream_status" '
|
|
'ut="$upstream_response_time" ul="$upstream_response_length" '
|
|
'cs=$upstream_cache_status' ;
|
|
|
|
# -------------------------------------------------------------------
|
|
|
|
# For SSL Compatibility - WP Super Cache and WP Rocket depend on this
|
|
map $scheme $https_suffix { default ''; https '-https'; }
|
|
|
|
# -------------------------------------------------------------------
|
|
|
|
### Fine-tune logging
|
|
# ref: https://nginx.org/r/access_log
|
|
map $status $loggable {
|
|
~^[23] 0;
|
|
default 1;
|
|
}
|
|
|
|
# -------------------------------------------------------------------
|
|
|
|
# https://jdh8.github.io/charset-for-text-on-nginx/
|
|
map $sent_http_content_type $charset {
|
|
~^text/ utf-8;
|
|
}
|
|
|
|
charset $charset;
|
|
charset_types *;
|
|
|
|
# -------------------------------------------------------------------
|
|
|
|
# if you'd like to hide some header info, uncomment this
|
|
# include globals/hide-headers.conf;
|
|
|
|
# -------------------------------------------------------------------
|
|
#
|
|
# if you'd like to use cloudflare servers, uncomment this
|
|
# include globals/cloudflare.conf;
|
|
# include globals/sucuri-real-ip.conf;
|
|
|
|
# -------------------------------------------------------------------
|
|
|
|
# webp support
|
|
# see: https://docs.ewww.io/article/16-ewww-io-and-webp-images
|
|
|
|
map $http_accept $webp_suffix {
|
|
default "";
|
|
"~*webp" ".webp";
|
|
}
|
|
|
|
# -------------------------------------------------------------------
|