啟動 Nginx 報錯:nginx: [emerg] unexpected end of file, expecting ";" or "}" in /etc/mime.types:832
Debian 7 系統自帶的 /etc/mime.types 文件格式與 Nginx 期望的不一致(可能缺少分號、大括號不匹配、編碼問題)。Nginx 配置中 include mime.types; 引入了該文件導致解析失敗。
cp /etc/mime.types /etc/mime.types.bakconf/mime.types 是標準格式。cp /usr/local/nginx/conf/mime.types /etc/mime.types(路徑視安裝方式調整); 或 },確保每行格式為 type/subtype ext1 ext2;。nginx -t 無錯誤後 systemctl reload nginx。--conf-path 到獨立目錄,避免依賴系統目錄文件。include /usr/local/nginx/conf/mime.types; 絕對路徑引用 Nginx 專屬 mime.types。nginx -t 驗證配置語法。