Helm Chart Release / release-chart (push) Successful in 6s
あるプロジェクトから「serverSnippet が効かない」「snippet は古いキー」との 指摘があり調査した結果、指摘の前提は誤りだった。 - 実際に使われる templates/configmap.yaml が読むのは snippet で、values.yaml と README も snippet で一致している。 - serverSnippet / httpSnippet は、.Values.nginx.enabled が存在せず一度も出力 されない configmap-nginx.yaml だけが読むキーで、values・README に載ったことが なく、指定しても黙って無視される。 - README 例6・例9 が snippet に client_max_body_size を書く手順になっており、 v8.5.9-b 以降は uploadMaxSize の自動出力と重複して nginx が起動しない (2026-09-29 の障害の発生源)。例6 は location ~ \.php$ も重複定義していた。 挙動の変更はなくドキュメント・コメントのみ。 - values.yaml / README: 読まれるキーは snippet のみ、挿入先は server ブロック内、 client_max_body_size は書かず uploadMaxSize を使うことを明記 - README 例6・例9 を uploadMaxSize 指定に修正 - configmap-nginx.yaml: 未使用であることを示す注記を追加 手動リリース 8.5.11-a。
101 lines
3.6 KiB
YAML
101 lines
3.6 KiB
YAML
{{- /*
|
||
【未使用】このファイルは出力されない。
|
||
下の if が参照する .Values.nginx.enabled は values.yaml に存在しないため、常に偽になる。
|
||
実際に使われる nginx 設定は templates/configmap.yaml(deployment.yaml が nginx.conf キーを
|
||
マウントしている)。カスタム設定として読まれるのは nginx.customConfig.snippet のみで、
|
||
このファイルだけが読む serverSnippet / httpSnippet は指定しても無視される。
|
||
nginx の設定を変更する場合は configmap.yaml を編集すること。
|
||
*/ -}}
|
||
{{- if .Values.nginx.enabled }}
|
||
apiVersion: v1
|
||
kind: ConfigMap
|
||
metadata:
|
||
name: {{ include "phpfpm.fullname" . }}-nginx-config
|
||
labels:
|
||
{{- include "phpfpm.labels" . | nindent 4 }}
|
||
data:
|
||
default.conf: |
|
||
{{- if or .Values.nginx.forwardRealIP.enabled (and .Values.nginx.customConfig.enabled .Values.nginx.customConfig.httpSnippet) }}
|
||
# HTTP-level configuration
|
||
{{- if .Values.nginx.forwardRealIP.enabled }}
|
||
# Real IP forwarding configuration
|
||
real_ip_header {{ .Values.nginx.forwardRealIP.header }};
|
||
{{- if .Values.nginx.forwardRealIP.recursive }}
|
||
real_ip_recursive on;
|
||
{{- end }}
|
||
|
||
# Trusted proxy networks
|
||
{{- range .Values.nginx.forwardRealIP.trustedProxies }}
|
||
set_real_ip_from {{ . }};
|
||
{{- end }}
|
||
{{- range .Values.nginx.forwardRealIP.additionalTrustedProxies }}
|
||
set_real_ip_from {{ . }};
|
||
{{- end }}
|
||
{{- end }}
|
||
|
||
{{- if and .Values.nginx.customConfig.enabled .Values.nginx.customConfig.httpSnippet }}
|
||
# Custom HTTP-level configuration
|
||
{{ .Values.nginx.customConfig.httpSnippet | nindent 4 }}
|
||
{{- end }}
|
||
{{- end }}
|
||
|
||
server {
|
||
listen 8080;
|
||
server_name _;
|
||
root /var/www/html;
|
||
index index.php index.html;
|
||
|
||
# Security headers
|
||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||
add_header X-Content-Type-Options "nosniff" always;
|
||
add_header X-XSS-Protection "1; mode=block" always;
|
||
|
||
{{- if and .Values.nginx.customConfig.enabled .Values.nginx.customConfig.serverSnippet }}
|
||
# Custom server-level configuration
|
||
{{ .Values.nginx.customConfig.serverSnippet | nindent 8 }}
|
||
{{- end }}
|
||
|
||
# Health check endpoint
|
||
location /health {
|
||
access_log off;
|
||
return 200 "healthy\n";
|
||
add_header Content-Type text/plain;
|
||
}
|
||
|
||
# Default location block
|
||
location / {
|
||
try_files $uri $uri/ /index.php?$query_string;
|
||
}
|
||
|
||
# PHP-FPM handler
|
||
location ~ \.php$ {
|
||
try_files $uri =404;
|
||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||
fastcgi_pass 127.0.0.1:9000;
|
||
fastcgi_index index.php;
|
||
include fastcgi_params;
|
||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||
|
||
{{- if .Values.nginx.forwardRealIP.enabled }}
|
||
# Pass real IP information to PHP-FPM
|
||
fastcgi_param REMOTE_ADDR $remote_addr;
|
||
fastcgi_param HTTP_X_REAL_IP $realip_remote_addr;
|
||
fastcgi_param HTTP_X_FORWARDED_FOR $proxy_add_x_forwarded_for;
|
||
{{- end }}
|
||
|
||
# Standard FastCGI parameters
|
||
fastcgi_param SERVER_NAME $host;
|
||
fastcgi_param SERVER_PORT $server_port;
|
||
fastcgi_param HTTPS $https if_not_empty;
|
||
}
|
||
|
||
# Deny access to hidden files
|
||
location ~ /\. {
|
||
deny all;
|
||
access_log off;
|
||
log_not_found off;
|
||
}
|
||
}
|
||
{{- end }}
|