Configuration is broken for service nginx: unknown directive "access_by_lua_file"

My YunoHost server

Hardware: VPS bought online
YunoHost version: 11.1.18
I have access to my server : Through SSH | through the webadmin
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no

Description of my issue

While installing Froxlor (PHP app with MySQL DB) as a custom My_Webapp I accidentally broke my nginx service. I could complete the installation process for Froxlor and access the web UI. However, when I attempted to run the config via webinterface, especially for nginx (see here: Configuration | Froxlor Documentation) the nginx service broke. Yunohost diagnosis shows me the following errors now.

Configuration is broken for service nginx!

nginx: [emerg] unknown directive "access_by_lua_file" in /etc/nginx/conf.d/business-suite.domain.tld.conf:11
nginx: configuration file /etc/nginx/nginx.conf test failed

Unfortunately, I couldn’t find a way to revert the command.

I found this old thread with the same error message: Unknown directive "access_by_lua_file" in nginx conf However, I am not sure if downgrading nginx is the solution in my case.

How can I fix my nginx service? Glad for any help on this.

Let’s look at dpkg --list | grep nginx

Thank you. This is the output.

ii  libnginx-mod-http-auth-pam            1.18.0-6.1+deb11u3                                amd64        PAM authentication module for Nginx
ii  libnginx-mod-http-cache-purge         1.18.0-6.1+deb11u3                                amd64        Purge content from Nginx caches
ii  libnginx-mod-http-dav-ext             1.18.0-6.1+deb11u3                                amd64        WebDAV missing commands support for Nginx
ii  libnginx-mod-http-echo                1.18.0-6.1+deb11u3                                amd64        Bring echo and more shell style goodies to Nginx
ii  libnginx-mod-http-fancyindex          1.18.0-6.1+deb11u3                                amd64        Fancy indexes module for the Nginx
ii  libnginx-mod-http-geoip               1.18.0-6.1+deb11u3                                amd64        GeoIP HTTP module for Nginx
ii  libnginx-mod-http-geoip2              1.18.0-6.1+deb11u3                                amd64        GeoIP2 HTTP module for Nginx
ii  libnginx-mod-http-headers-more-filter 1.18.0-6.1+deb11u3                                amd64        Set and clear input and output headers for Nginx
ii  libnginx-mod-http-image-filter        1.18.0-6.1+deb11u3                                amd64        HTTP image filter module for Nginx
ii  libnginx-mod-http-lua                 1.18.0-6.1+deb11u3                                amd64        Lua module for Nginx
ii  libnginx-mod-http-ndk                 1.18.0-6.1+deb11u3                                amd64        Nginx Development Kit module
ii  libnginx-mod-http-perl                1.18.0-6.1+deb11u3                                amd64        Perl module for Nginx
ii  libnginx-mod-http-subs-filter         1.18.0-6.1+deb11u3                                amd64        Substitution filter module for Nginx
ii  libnginx-mod-http-uploadprogress      1.18.0-6.1+deb11u3                                amd64        Upload progress system for Nginx
ii  libnginx-mod-http-upstream-fair       1.18.0-6.1+deb11u3                                amd64        Nginx Upstream Fair Proxy Load Balancer
ii  libnginx-mod-http-xslt-filter         1.18.0-6.1+deb11u3                                amd64        XSLT Transformation module for Nginx
ii  libnginx-mod-mail                     1.18.0-6.1+deb11u3                                amd64        Mail module for Nginx
ii  libnginx-mod-nchan                    1.18.0-6.1+deb11u3                                amd64        Fast, flexible pub/sub server for Nginx
ii  libnginx-mod-stream                   1.18.0-6.1+deb11u3                                amd64        Stream module for Nginx
ii  libnginx-mod-stream-geoip             1.18.0-6.1+deb11u3                                amd64        GeoIP Stream module for Nginx
ii  libnginx-mod-stream-geoip2            1.18.0-6.1+deb11u3                                amd64        GeoIP2 Stream module for Nginx
ii  nginx                                 1.18.0-6.1+deb11u3                                all          small, powerful, scalable web/proxy server
ii  nginx-common                          1.18.0-6.1+deb11u3                                all          small, powerful, scalable web/proxy server - common fles
ii  nginx-extras                          1.18.0-6.1+deb11u3                                amd64        nginx web/proxy server (extended version)

Do you see anything suspicious in the output @Aleks ?

Not really, you do have libnginx-mod-http-lua, v1.18.0-6.1+deb11u3 installed, which is the expectation …

Let’s also look at ls -l /etc/nginx/modules-enabled and confirm that 50-mod-http-lua.conf is listed in there

And also check that

grep -nr "modules" /etc/nginx/nginx.conf

shows:

include /etc/nginx/modules-enabled/*.conf;

Thank you @Aleks for the suggestions. Unfortunately, I needed to have my Yunohost back up running quickly as I needed urgent access to some of my apps. So, I reinstalled Yunohost to solve the issue. I know, this is not the best way as I would have been interested too to get to the root cause of the problem.

In case somebody finds time to look at it. It’s really easy to reproduce. Just install a custom web app for Froxlor and install the app from tarball as described here: Install froxlor from Tarball | Froxlor Documentation I could successfully complete steps 1 to 4.

Step 5 - Configuration of services - was where nginx got broken. Via webadmin interface I generated the command (including nginx conf adoptions) and executed it as root (which was probably not the smartest idea). This is how the error was produced.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.