templates/configmap.yaml を更新

This commit is contained in:
2025-12-16 22:44:07 +00:00
parent a8cebda66f
commit 295983f6de

View File

@@ -52,17 +52,30 @@ data:
access_log off; access_log off;
} }
# WordPressのパーマリンク対応 # wp-adminディレクトリへのアクセス処理重要
location / { location /wp-admin {
try_files $uri $uri/ /index.php?$args; # wp-adminへのアクセスは必ず末尾スラッシュにリダイレクト
rewrite ^(/wp-admin)$ $1/ permanent;
# wp-admin内のファイルを処理
try_files $uri $uri/ /wp-admin/index.php?$args;
} }
# PHPファイルの処理 # wp-includesディレクトリ静的ファイル優先)
location /wp-includes {
try_files $uri $uri/ =404;
}
# wp-contentディレクトリ静的ファイル優先
location /wp-content {
try_files $uri $uri/ =404;
}
# PHPファイルの処理最も重要
location ~ \.php$ { location ~ \.php$ {
# ファイルが存在しない場合は404 # セキュリティ: cgi.fix_pathinfo=0 の代替
try_files $uri =404; try_files $uri =404;
# FastCGI設定
fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000; fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php; fastcgi_index index.php;
@@ -94,6 +107,13 @@ data:
fastcgi_buffer_size 32k; fastcgi_buffer_size 32k;
} }
# WordPressのパーマリンク対応メインロケーション
location / {
# 存在するファイル/ディレクトリ → そのまま配信
# 存在しない → index.phpで処理WordPressルーティング
try_files $uri $uri/ /index.php?$args;
}
# 静的ファイルのキャッシュ # 静的ファイルのキャッシュ
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|otf)$ { location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|otf)$ {
expires 1y; expires 1y;
@@ -114,6 +134,11 @@ data:
log_not_found off; log_not_found off;
} }
# readme.html等の情報漏洩防止
location ~* ^/(readme|license)\.(html|txt)$ {
deny all;
}
# XML-RPC DDoS対策必要に応じてコメント解除 # XML-RPC DDoS対策必要に応じてコメント解除
# location = /xmlrpc.php { # location = /xmlrpc.php {
# deny all; # deny all;