diff --git a/templates/configmap.yaml b/templates/configmap.yaml index 06ba068..90ccf1c 100644 --- a/templates/configmap.yaml +++ b/templates/configmap.yaml @@ -47,7 +47,16 @@ data: rewrite ^(/[^/]+)?(/.*\.php) $2 last; } - # PHP処理(最優先) + # 静的ファイル(画像、CSS、JSなど) + location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot|webp)$ { + expires max; + log_not_found off; + access_log off; + add_header Cache-Control "public, immutable"; + try_files $uri =404; + } + + # PHP処理 location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; @@ -70,19 +79,10 @@ data: fastcgi_read_timeout 300; } + # その他全て(パーマリンク対応) location / { try_files $uri $uri/ /index.php?$args; } - - # WordPress管理画面 - location ~ ^/(wp-admin|wp-login\.php) { - try_files $uri $uri/ /index.php?$args; - } - - # パーマリンク対応(投稿・固定ページ) - location ~ ^/(.+)$ { - try_files $uri $uri/ /index.php?$args; - } location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { expires max; @@ -94,12 +94,14 @@ data: location = /favicon.ico { log_not_found off; access_log off; + try_files $uri =404; } location = /robots.txt { allow all; log_not_found off; access_log off; + try_files $uri =404; } location ~ /\. {