nginx: [emerg] open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)错误解决

错误提示:

root@OpenWrt:/usr/sbin# ./nginx -t
nginx: [emerg] open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)
nginx: configuration file /etc/nginx/nginx.conf test failed

根据提示去看有没有nginx.conf文件:

root@OpenWrt:/etc# cd nginx/
root@OpenWrt:/etc/nginx# ls
fastcgi_params_bak  koi-utf             koi-win             mime.types          nginx.conf_bak      win-utf
root@OpenWrt:/etc/nginx# cp nginx.conf_bak nginx.conf
root@OpenWrt:/etc/nginx# cp fastcgi_params_bak fastcgi_params

发现文件加了个bak后缀,应该是安装失败我强制停止再重新安装的时候导致的,把bak去掉后再试:

root@OpenWrt:/usr/sbin# ./nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

nginx successful~

你可能感兴趣的:(OpenWRT)