Go to openwrt

Issues with nginx; Startup

upon installing nginx I'm met with an error

[emerg] 4933#0: mkdir() "/var/lib/nginx/body" failed (2: No such file or directory)"

/etc/init.d/nginx contains this line

[ -d /var/lib/nginx ] || mkdir -p /var/lib/nginx

If I run mkdir -p /var/lib/nginx it works as intended

If I add mkdir -p /var/lib/nginx to /etc/init.d/php-fpm I can basically dodge this issue, however this feels like a hack

So, why isnt the folder being created by nginx's own startup script? How can a fresh install be so bugged?

Sort by:

Best

Open comment sort options

  • Best

  • Top

  • New

  • Controversial

  • Old

  • Q&A

  • That error looks like it's coming from nginx logs not init.d script output. Is it? If so then nginx can't create the body directory because the parent doesn't exist I'd guess. The init.d script looks fine and should create the parent which should satisfy nginx.

    Have you tried running the init.d yourself?

    I wanted to come back to clear the air for future readers.

    You will see in nginx init.d script

    [ -z "${CONF}" ] || return # already called.

    This always returns because the nginx init script sets CONF at the top of init.d script.

    CONF="/etc/nginx/nginx.conf"

    How it is that the package maintainer hasnt realized this I am really not sure, do they not even attempt to use the packages theyre publishing? Straight out of the box, nginx on openwrt always fails to start because of this.