fix: sitemap.xmlのContent-Typeを application/xml; charset=utf-8 に明示 (v8.5.9-a)
Helm Chart Release / release-chart (push) Successful in 7s
Helm Chart Release / release-chart (push) Successful in 7s
標準のmime.typesでは .xml が text/xml 扱いとなりcharsetが付与されず、
ブラウザやGoogle Search Consoleなどのツールが正しく解釈できない
場合があった。
templates/configmap.yaml のnginx設定に location = /sitemap.xml を
追加し、types {} + default_type で明示的にContent-Typeを指定する
ようにした。静的ファイルの場合のみ有効(PHP動的生成には別途
header()指定が必要)。設定不要・常時有効。
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,35 @@
|
|||||||
|
# Changelog - Version 8.5.9-a
|
||||||
|
|
||||||
|
## 修正
|
||||||
|
|
||||||
|
### sitemap.xml のContent-Typeを明示的に指定
|
||||||
|
|
||||||
|
`/sitemap.xml`(静的ファイル)へのアクセス時、標準の `mime.types` では `.xml` が `text/xml` 扱いとなり `charset` が付与されないため、ブラウザやGoogle Search Consoleなどのツールが正しく解釈できない場合がありました。
|
||||||
|
|
||||||
|
**対応**: `templates/configmap.yaml` のnginx設定に `location = /sitemap.xml` を追加し、`types { } default_type "application/xml; charset=utf-8";` によって明示的にContent-Typeを指定するようにしました。
|
||||||
|
|
||||||
|
```nginx
|
||||||
|
location = /sitemap.xml {
|
||||||
|
types { }
|
||||||
|
default_type "application/xml; charset=utf-8";
|
||||||
|
try_files $uri =404;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 注意事項
|
||||||
|
|
||||||
|
- この対応は `/sitemap.xml` が**静的ファイル**として `html/` 直下に配置されている場合に適用されます。
|
||||||
|
- PHPで動的に生成する場合(`/index.php` へのフォールバック経由)は、nginxのこの設定は適用されません。PHP側で `header('Content-Type: application/xml; charset=utf-8');` を明示的に指定してください。
|
||||||
|
- 設定不要・常時有効です(values.yamlへの変更はありません)。ファイルが存在しない場合は従来どおり404を返します。
|
||||||
|
|
||||||
|
## アップグレード手順
|
||||||
|
|
||||||
|
```bash
|
||||||
|
helm repo update
|
||||||
|
helm upgrade <リリース名> cafepieters/phpfpm --version 8.5.9-a -f values.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**リリース日**: 2026-08-06
|
||||||
|
**担当**: プロサーバーエンジニア(Claude)
|
||||||
@@ -22,6 +22,12 @@ Raspberry Pi などのベアメタルで稼働することを想定した、Kube
|
|||||||
|
|
||||||
## チャート改修履歴
|
## チャート改修履歴
|
||||||
|
|
||||||
|
### sitemap.xml のContent-Type明示(2026-08-06, v8.5.9-a)
|
||||||
|
|
||||||
|
`templates/configmap.yaml`(実際に使われているnginx設定。`templates/configmap-nginx.yaml` は `.Values.nginx.enabled` が values.yaml に存在せず常に未出力の死んだファイルなので注意)に `location = /sitemap.xml { types { } default_type "application/xml; charset=utf-8"; ... }` を追加。標準mime.typesでは `.xml` が `text/xml` 扱いでcharset無しになる問題への対応。静的ファイルの場合のみ有効、PHP動的生成には効かない(PHP側でheader()指定が必要)。設定不要・常時有効。
|
||||||
|
|
||||||
|
**対象ファイル**: `templates/configmap.yaml`, `README.md`, `Chart.yaml`, `CHANGELOG-8.5.9-a.md`
|
||||||
|
|
||||||
### Python導入オプションの追加(2026-07-19, v8.5.8-a)
|
### Python導入オプションの追加(2026-07-19, v8.5.8-a)
|
||||||
|
|
||||||
`python` セクションを新設し、`values.yaml` の設定だけでPython仮想環境(venv)を導入可能にした。Composerと同じ設計方針(デフォルト導入先 `/venv` はPVC非マウントの使い捨て領域、`packages`/`useRequirementsTxt`の二択、`additionalApkPackages`でネイティブ拡張ビルド対応)。requirements.txtの展開は `trim | nindent 14`(v8.5.6-dのバグ修正と同じ手法)。PHPからは `exec('/venv/bin/python3 script.py')` で呼び出す。
|
`python` セクションを新設し、`values.yaml` の設定だけでPython仮想環境(venv)を導入可能にした。Composerと同じ設計方針(デフォルト導入先 `/venv` はPVC非マウントの使い捨て領域、`packages`/`useRequirementsTxt`の二択、`additionalApkPackages`でネイティブ拡張ビルド対応)。requirements.txtの展開は `trim | nindent 14`(v8.5.6-dのバグ修正と同じ手法)。PHPからは `exec('/venv/bin/python3 script.py')` で呼び出す。
|
||||||
|
|||||||
+1
-1
@@ -2,6 +2,6 @@ apiVersion: v2
|
|||||||
name: phpfpm
|
name: phpfpm
|
||||||
description: Nginx + PHP-FPM Helm Chart with external DB and optional Selenium support
|
description: Nginx + PHP-FPM Helm Chart with external DB and optional Selenium support
|
||||||
type: application
|
type: application
|
||||||
version: 8.5.9
|
version: 8.5.9-a
|
||||||
appVersion: "8.5.9"
|
appVersion: "8.5.9"
|
||||||
icon: https://upload.wikimedia.org/wikipedia/commons/thumb/2/27/PHP-logo.svg/330px-PHP-logo.svg.png
|
icon: https://upload.wikimedia.org/wikipedia/commons/thumb/2/27/PHP-logo.svg/330px-PHP-logo.svg.png
|
||||||
|
|||||||
@@ -225,6 +225,10 @@ PHP 側では `$_ENV['KEY']` または `getenv('KEY')` で取得できます。
|
|||||||
| `nginx.forwardRealIP.trustedProxies` | 信頼するプロキシネットワーク | `["10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"]` |
|
| `nginx.forwardRealIP.trustedProxies` | 信頼するプロキシネットワーク | `["10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"]` |
|
||||||
| `nginx.forwardRealIP.additionalTrustedProxies` | 追加の信頼プロキシ | `[]` |
|
| `nginx.forwardRealIP.additionalTrustedProxies` | 追加の信頼プロキシ | `[]` |
|
||||||
|
|
||||||
|
> **📌 sitemap.xml のContent-Type**
|
||||||
|
> `/sitemap.xml`(静的ファイルとして配置した場合)は、常に `Content-Type: application/xml; charset=utf-8` で配信されます。標準の `mime.types` では `.xml` が `text/xml` 扱いでcharsetが付かず、ブラウザやGoogle Search Consoleなどのツールが正しく解釈できない場合があるための組み込み対応です(設定不要、常時有効)。
|
||||||
|
> なお、PHPで動的に生成する場合はこの設定は適用されません(PHP側で `header('Content-Type: application/xml; charset=utf-8');` を指定してください)。
|
||||||
|
|
||||||
## 使用例
|
## 使用例
|
||||||
|
|
||||||
### 例1: シンプルなPHPアプリケーション
|
### 例1: シンプルなPHPアプリケーション
|
||||||
|
|||||||
@@ -55,6 +55,15 @@ data:
|
|||||||
root /var/www/html;
|
root /var/www/html;
|
||||||
index index.php index.html index.htm;
|
index index.php index.html index.htm;
|
||||||
|
|
||||||
|
# sitemap.xml のContent-Typeを明示的に指定
|
||||||
|
# 標準のmime.typesでは .xml は text/xml 扱いでcharsetが付かず、
|
||||||
|
# ブラウザやSearch Consoleが正しく解釈できない場合があるため
|
||||||
|
location = /sitemap.xml {
|
||||||
|
types { }
|
||||||
|
default_type "application/xml; charset=utf-8";
|
||||||
|
try_files $uri =404;
|
||||||
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
try_files $uri $uri/ /index.php?$query_string;
|
try_files $uri $uri/ /index.php?$query_string;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user