V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
OpenWrt 是一个专门面向嵌入式设备的 Linux 发行版。你可以将 OpenWrt 支持的型号的嵌入式设备,比如各种路由器上的系统,换成一个有更多可能性可以折腾的 Linux 系统。
OpenWrt 官方网站
AllenHua
V2EX  ›  OpenWrt

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

  •  
  •   AllenHua · 2021-03-14 11:55:09 +08:00 · 1137 次点击
    这是一个创建于 1166 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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之类的文件也没有,求助……

    2 条回复    2022-11-11 13:36:25 +08:00
    AllenHua
        1
    AllenHua  
    OP
       2021-03-14 13:43:24 +08:00
    换了个固件 已经可以了
    wanmyj
        2
    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
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2341 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 16:00 · PVG 00:00 · LAX 09:00 · JFK 12:00
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.