61 lines
1.5 KiB
YAML
61 lines
1.5 KiB
YAML
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: nginx-config
|
|
data:
|
|
default.conf: |
|
|
# Upstream with keepalive
|
|
upstream php-upstream {
|
|
server php-fpm:9000;
|
|
keepalive 32;
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
root /var/www/html;
|
|
index index.php index.html;
|
|
|
|
# Gzip compression
|
|
gzip on;
|
|
gzip_vary on;
|
|
gzip_min_length 1024;
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml;
|
|
|
|
# Buffer settings
|
|
client_body_buffer_size 16k;
|
|
client_max_body_size 10m;
|
|
|
|
location / {
|
|
try_files $uri $uri/ /index.php?$query_string;
|
|
}
|
|
|
|
location ~ \.php$ {
|
|
fastcgi_pass php-upstream;
|
|
fastcgi_index index.php;
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
include fastcgi_params;
|
|
|
|
# FastCGI optimization
|
|
fastcgi_keep_conn on;
|
|
fastcgi_buffer_size 32k;
|
|
fastcgi_buffers 16 16k;
|
|
fastcgi_busy_buffers_size 32k;
|
|
fastcgi_read_timeout 60s;
|
|
fastcgi_send_timeout 60s;
|
|
|
|
# Connection reuse
|
|
fastcgi_connect_timeout 5s;
|
|
}
|
|
|
|
location ~ /\.ht {
|
|
deny all;
|
|
}
|
|
|
|
# Static files caching
|
|
location ~* \.(jpg|jpeg|png|gif|ico|css|js)$ {
|
|
expires 7d;
|
|
add_header Cache-Control "public, immutable";
|
|
}
|
|
}
|