diff --git a/templates/configmap.yaml b/templates/configmap.yaml index 47ca10b..15e198d 100644 --- a/templates/configmap.yaml +++ b/templates/configmap.yaml @@ -49,24 +49,31 @@ data: access_log off; } + # templates/configmap.yaml の nginx.conf セクション location / { try_files $uri $uri/ /index.php?$args; } - location ~ \.php$ { - include fastcgi_params; - fastcgi_intercept_errors on; - fastcgi_pass php; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param HTTPS $fastcgi_https; - fastcgi_param HTTP_X_FORWARDED_PROTO $http_x_forwarded_proto; - fastcgi_param HTTP_X_FORWARDED_FOR $http_x_forwarded_for; - fastcgi_param HTTP_X_REAL_IP $real_ip; - fastcgi_param REMOTE_ADDR $real_ip; + # WordPress管理画面用の設定 + location ~ ^/(wp-admin|wp-login\.php) { + try_files $uri $uri/ /index.php?$args; } - location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ { + # PHPファイルの処理 + location ~ \.php$ { + try_files $uri =404; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass 127.0.0.1:9000; # または wordpress コンテナのサービス名 + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + } + + # 静的ファイルのキャッシュ設定(オプション) + location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { expires max; log_not_found off; + access_log off; } } \ No newline at end of file