首页
/
每日頭條
/
科技
/
nginx配置文件解析
nginx配置文件解析
更新时间:2026-09-12 00:40:06
nginx: [emerg] invalid number of arguments in "root" directive in /usr/local/nginx/conf/nginx.conf:20

nginx配置文件解析(nginx配置文件報錯nginx:)1

錯誤原因:配置文件第20行報錯

輸入命令再次檢查:配置文件信息:

在sbin目錄下

輸入nginx -t

nginx: [emerg] invalid number of arguments in "root" directive in /usr/local/nginx/conf/nginx.conf:20

nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed

nginx配置文件解析(nginx配置文件報錯nginx:)2

确定了配置文件有問題

找到配置文件

nginx配置文件解析(nginx配置文件報錯nginx:)3

發現20行上面19行 少一個分号;

問題找到,添加分号後,保存成功.再檢查配置文件nginx -t

nginx配置文件解析(nginx配置文件報錯nginx:)4

重啟nginx

重啟命令./nginx 或者重新加載啟動

...nginx/sbin/nginx -c .../nginx/sbin/conf/nginx.conf

目錄下的以及子目錄下的所有執行權限可讀可寫可操作權限chmod 777 -R ./html或者 chmod -R u x ./html

nginx配置文件解析(nginx配置文件報錯nginx:)5

nginx配置文件解析(nginx配置文件報錯nginx:)6

,
Comments
Welcome to tft每日頭條 comments! Please keep conversations courteous and on-topic. To fosterproductive and respectful conversations, you may see comments from our Community Managers.
Sign up to post
Sort by
Show More Comments
Copyright 2023-2026 - www.tftnews.com All Rights Reserved