若需在 Nginx 中使用 Server Side Includes (SSI) 處理 .shtml 檔案,只需修改 nginx.conf 設定檔即可。以下為完整步驟:
在 nginx.conf 的 http 區塊中加入下列三行指令:
ssi on;
ssi_silent_errors on;
ssi_types text/shtml;
儲存設定檔後,重新載入或重啟 Nginx 使設定生效:
nginx -s reload
# 或
systemctl restart nginx
完成後,Nginx 即可正確解析 .shtml 檔案中的 SSI 指令(如 ),實現頁面片段重用與動態內容嵌入。