openwrt 安装的 nginx 没有 nginx.conf 这个配置文件导致无法启动,是怎么回事?

2021-03-14 11:55:09 +08:00
 AllenHua
opkg install nginx

执行之后 安装成功 有以下安装包

luci-nginx - git-20.161.73418-219f0ce
nginx - 1.19.6-2
nginx-mod-luci - 1.19.6-2
nginx-ssl - 1.19.6-2
nginx-ssl-util - 1.5-1
nginx-util - 1.5-1

但是无法启动,报错 [emerg] 32542#0: open() "/etc/nginx/nginx.conf" failed (2: No such file or directory) nginx: configuration file /etc/nginx/nginx.conf test failed

which nginx 后 发现 nginx 可执行文件路径是 /usr/sbin/nginx

/etc/nginx 目录下有这些内容

drwxr-xr-x    2 root     root          4096 Mar 14 11:42 conf.d
-rw-r--r--    1 root     root          1007 Mar  7 06:06 fastcgi_params
-rw-r--r--    1 root     root          2837 Mar  7 06:06 koi-utf
-rw-r--r--    1 root     root          2223 Mar  7 06:06 koi-win
-rw-r--r--    1 root     root          5231 Mar  7 06:06 mime.types
-rw-r-----    1 root     root          5798 Mar  7 06:06 naxsi_core.rules
-rw-------    1 root     root           183 Nov 29 01:34 restrict_locally
lrwxrwxrwx    1 root     root            23 Mar 14 11:42 uci.conf -> /var/lib/nginx/uci.conf
-rw-------    1 root     root           699 Nov 29 01:34 uci.conf.template
-rw-r--r--    1 root     root           664 Mar  7 06:06 uwsgi_params
-rw-r--r--    1 root     root          3610 Mar  7 06:06 win-utf

使用 find / -name nginx.conf 搜不到磁盘内有这个文件,nginx.conf_bak之类的文件也没有,求助……

1169 次点击
所在节点    OpenWrt
2 条回复
AllenHua
2021-03-14 13:43:24 +08:00
换了个固件 已经可以了
wanmyj
2022-11-11 13:36:25 +08:00
给其他朋友参考,op 的 nginx 的配置用的是 uci ,不用 /etc/nginx/nginx.conf ,用 uci.conf 就可以
https://openwrt.org/docs/guide-user/services/webserver/nginx

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/761472

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX