Impossible de réactiver Nginx? (unknown directive 'access_by_lua_file')

Bonjour à tous,

Suite à la mise à jour récente de très nombreux packages Debian, impossible d’accéder à mon serveur dédié par le Web. Tout le reste fonctionne (SSH, mail, etc.), j’en conclue donc que le problème vient de Nginx.

-> Le fichier /var/log/nginx/error.log contient cette ligne :

2018/01/18 10:20:15 [emerg] 16913#16913: unknown directive "access_by_lua_file" in /etc/nginx/conf.d/******.nohost.me.conf:6

Celle-ci renvoit donc à la ligne du fichier de conf netflix qui est “access_by_lua_file /usr/share/ssowat/access.lua;”. Rapport avec le SSO ? Mais pourquoi “unknow directive” ?

-> Quand je fais un ‘systemctl status nginx.service’ j’obtiens ça :slight_smile:

● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since jeu. 2018-01-18 10:20:15 CET; 11s ago
     Docs: man:nginx(8)
  Process: 16913 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, s

janv. 18 10:20:15 ****** systemd[1]: Starting A high performance web server and a reverse proxy serve
janv. 18 10:20:15 ****** nginx[16913]: nginx: [emerg] unknown directive "access_by_lua_file" in /etc/
janv. 18 10:20:15 ****** nginx[16913]: nginx: configuration file /etc/nginx/nginx.conf test failed
janv. 18 10:20:15 ****** systemd[1]: nginx.service: Control process exited, code=exited status=1
janv. 18 10:20:15 ****** systemd[1]: Failed to start A high performance web server and a reverse prox
janv. 18 10:20:15 ****** systemd[1]: nginx.service: Unit entered failed state.
janv. 18 10:20:15 ****** systemd[1]: nginx.service: Failed with result 'exit-code'.

Ca ne m’étais jamais arrivé, et à vrai dire je sais pas trop comment m’en sortir :confused: Si quelqu’un a un conseil pour m’aider à le dépanner, ce serait vraiment très sympa.

Merci par avance de votre aide ! :slight_smile:

Ebeeeen, ca ressemble à un truc où ton serveur est passé sous Stretch :confused:

Que donne un lsb_release -a et un dpkg --list | grep nginx ?

Merci de ta réponse :slight_smile:

La première commande donne ça (donc a priori toujours sous Jessie ?) :

    No LSB modules are available.
    Distributor ID:	Debian
    Description:	Debian GNU/Linux 8.10 (jessie)
    Release:	8.10
    Codename:	jessie 

La deuxième :

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

C’est moi où il m’a mis un Nginx Stretch sur un Jessie ? (ou je comprends mal ?)

Merci encore pour l’aide !

Hm dans ce cas on peut peut-être s’en sortir :stuck_out_tongue:

C’est peut-être un coup des … backports ! (Jingle strident de film d’horreur)

Que donne un dpkg -l |awk '/^ii/ && $3 ~ /bpo[6-8]/ {print $2}' ?

1 Like

L’angoisse monte ! Je connais mal mais du coup c’est une sorte de portage d’une version plus récente qui s’est greffée ?

Alors attention la liste est longue, voici le résultat de la commande :slight_smile:

autoconf
autoconf-archive
autopoint
bash-completion
debhelper
dh-autoreconf
dh-python
dh-strip-nondeterminism
dmidecode
dovecot-antispam
dovecot-core
dovecot-imapd
dovecot-ldap
dovecot-lmtpd
dovecot-managesieved
dovecot-sieve
e2fslibs:amd64
e2fsprogs
geoip-database
gettext
gettext-base
git
git-man
gyp
ifupdown
irqbalance
jq
ldap-utils
libapparmor1:amd64
libasprintf-dev:amd64
libasprintf0c2:amd64
libassuan0:amd64
libc-ares-dev:amd64
libc-ares2:amd64
libcomerr2:amd64
libcups2:amd64
libcupsimage2:amd64
libfastjson4:amd64
libfftw3-double3:amd64
libfile-stripnondeterminism-perl
libgcrypt20:amd64
libgeoip1:amd64
libgettextpo-dev:amd64
libgettextpo0:amd64
libglib2.0-0:amd64
libglib2.0-data
libgpg-error0:amd64
libjq1:amd64
libjs-inherits
libjs-jquery
libjs-underscore
libksba8:amd64
libldap-2.4-2:amd64
libldap-common
liblognorm5:amd64
libnss-myhostname:amd64
libodbc1:amd64
libseccomp2:amd64
libsqlite3-0:amd64
libss2:amd64
libssl-dev:amd64
libssl-doc
libssl1.0.0:amd64
libsystemd0:amd64
libudev1:amd64
libunbound2:amd64
libuv1:amd64
linux-base
linux-image-4.9.0-0.bpo.5-amd64
linux-image-amd64
linux-libc-dev:amd64
manpages
manpages-dev
node-inherits
node-underscore
nodejs
nodejs-legacy
openntpd
openssl
pinentry-gtk2
python-cffi
python-cffi-backend
python-cryptography
python-debianbts
python-dnspython
python-gevent
python-greenlet
python-idna
python-ipaddress
python-ndg-httpsclient
python-openssl
python-pil:amd64
python-pkg-resources
python-ply
python-psutil
python-pyasn1
python-pycparser
python-pygments
python-pyinotify
python-pysimplesoap
python-reportbug
python-requests
python-setuptools
python-six
python-urllib3
python3-jinja2
python3-pkg-resources
python3-psutil
python3-pyasn1
redis-server
redis-tools
reportbug
rsyslog
shared-mime-info
slapd
systemd
systemd-sysv
tar
udev

As-tu le fichier /etc/nginx/modules-enabled/50-mod-http-lua.conf et que contient-il ?

Je n’ai pas le fichier… le dossier “modules-enabled” est vide. :confused:

Ca expliquerait plutôt bien ton problème !
As-tu des fichiers dans le répertoire /etc/nginx/modules-enabled/ et le répertoire /usr/share/nginx/modules-available ?

RIen dans “modules-enabled”, par contre dans “modules-available” j’ai cette liste de fichiers :

mod-http-auth-pam.conf		   mod-http-ndk.conf
mod-http-cache-purge.conf	   mod-http-perl.conf
mod-http-dav-ext.conf		   mod-http-subs-filter.conf
mod-http-echo.conf		   mod-http-uploadprogress.conf
mod-http-fancyindex.conf	   mod-http-upstream-fair.conf
mod-http-geoip.conf		   mod-http-xslt-filter.conf
mod-http-headers-more-filter.conf  mod-mail.conf
mod-http-image-filter.conf	   mod-nchan.conf
mod-http-lua.conf		   mod-stream.conf

Faut-il que je récupère le fichier de conf lua pour le mettre dans les modules-enabled ?

Si cela peut aider, voilà ce que j’ai sur mon serveur :

root:~# ll /etc/nginx/modules-enabled/
total 28
lrwxrwxrwx 1 root root 52 oct.   8 10:52 10-mod-http-ndk.conf -> /usr/share/nginx/modules-available/mod-http-ndk.conf
lrwxrwxrwx 1 root root 57 oct.   8 10:52 50-mod-http-auth-pam.conf -> /usr/share/nginx/modules-available/mod-http-auth-pam.conf
lrwxrwxrwx 1 root root 60 oct.   8 10:52 50-mod-http-cache-purge.conf -> /usr/share/nginx/modules-available/mod-http-cache-purge.conf
lrwxrwxrwx 1 root root 56 oct.   8 10:52 50-mod-http-dav-ext.conf -> /usr/share/nginx/modules-available/mod-http-dav-ext.conf
lrwxrwxrwx 1 root root 53 oct.   8 10:52 50-mod-http-echo.conf -> /usr/share/nginx/modules-available/mod-http-echo.conf
lrwxrwxrwx 1 root root 59 oct.   8 10:52 50-mod-http-fancyindex.conf -> /usr/share/nginx/modules-available/mod-http-fancyindex.conf
lrwxrwxrwx 1 root root 54 oct.   8 10:52 50-mod-http-geoip.conf -> /usr/share/nginx/modules-available/mod-http-geoip.conf
lrwxrwxrwx 1 root root 68 oct.   8 10:52 50-mod-http-headers-more-filter.conf -> /usr/share/nginx/modules-available/mod-http-headers-more-filter.conf
lrwxrwxrwx 1 root root 61 oct.   8 10:52 50-mod-http-image-filter.conf -> /usr/share/nginx/modules-available/mod-http-image-filter.conf
lrwxrwxrwx 1 root root 52 oct.   8 10:52 50-mod-http-lua.conf -> /usr/share/nginx/modules-available/mod-http-lua.conf
lrwxrwxrwx 1 root root 53 oct.   8 10:52 50-mod-http-perl.conf -> /usr/share/nginx/modules-available/mod-http-perl.conf
lrwxrwxrwx 1 root root 60 oct.   8 10:52 50-mod-http-subs-filter.conf -> /usr/share/nginx/modules-available/mod-http-subs-filter.conf
lrwxrwxrwx 1 root root 63 oct.   8 10:52 50-mod-http-uploadprogress.conf -> /usr/share/nginx/modules-available/mod-http-uploadprogress.conf
lrwxrwxrwx 1 root root 62 oct.   8 10:52 50-mod-http-upstream-fair.conf -> /usr/share/nginx/modules-available/mod-http-upstream-fair.conf
lrwxrwxrwx 1 root root 60 oct.   8 10:52 50-mod-http-xslt-filter.conf -> /usr/share/nginx/modules-available/mod-http-xslt-filter.conf
lrwxrwxrwx 1 root root 48 oct.   8 10:52 50-mod-mail.conf -> /usr/share/nginx/modules-available/mod-mail.conf
lrwxrwxrwx 1 root root 49 oct.   8 10:52 50-mod-nchan.conf -> /usr/share/nginx/modules-available/mod-nchan.conf
lrwxrwxrwx 1 root root 50 oct.   8 10:52 50-mod-stream.conf -> /usr/share/nginx/modules-available/mod-stream.conf
1 Like

Merci, du coup il faut que je crée des liens dans le dossier “enabled” vers ces fichiers là ? (Désolé de mes questions noob !)

Y’a pas de souci ! :slight_smile:
Tu as tout à fait raison, il te faut recréer tout ces liens symboliques dans le dossier /etc/nginx/modules-enabled.

Re !

Désolé du retard j’étais débordé. J’ai recréé les liens symboliques et reboot le serveur. Même problème, voici l’erreur :

2018/01/23 10:55:57 [emerg] 1784#1784: unknown directive "access_by_lua_file" in /etc/nginx/conf.d/******.nohost.me.conf:6

Une idée de piste ? :slight_smile: Merci encore pour l’aide…

C’est dans ton fichier à la ligne 6 il y a une directive inconnue.
ouvre le et regarde la ligne 6… tu peux la commenter en ajoutant un dieze au début de la ligne. et tester ta conf nginx en lancant la commande nginx -t

Voici mon fichier de conf à moi avec un domaine toto.fr pour comparer
server {
listen 80;
listen [::]:80;
server_name toto.fr;

access_by_lua_file /usr/share/ssowat/access.lua;

include conf.d/toto.fr.d/*.conf;

location /yunohost/admin {
    return 301 https://$http_host$request_uri;
}

access_log /var/log/nginx/toto.fr-access.log;
error_log /var/log/nginx/toto.fr-error.log;

}

server {
listen 443 ssl;
listen [::]:443 ssl;
server_name toto.fr;

ssl_certificate /etc/yunohost/certs/toto.fr/crt.pem;
ssl_certificate_key /etc/yunohost/certs/toto.fr/key.pem;
ssl_session_timeout 5m;
ssl_session_cache shared:SSL:50m;

ssl_prefer_server_ciphers on;

# Ciphers with intermediate compatibility
# https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=nginx-1.6.2&openssl=1.0.1t&hsts=yes&pro$
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-A$

# Ciphers with modern compatibility
# https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=nginx-1.6.2&openssl=1.0.1t&hsts=yes&pro$
# Uncomment the following to use modern ciphers, but remove compatibility with some old clients (android < 5.0, $
#ssl_protocols TLSv1.2;
#ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-$

# Uncomment the following directive after DH generation
# > openssl dhparam -out /etc/ssl/private/dh2048.pem -outform PEM -2 2048
#ssl_dhparam /etc/ssl/private/dh2048.pem;

add_header Strict-Transport-Security "max-age=31536000;";

access_by_lua_file /usr/share/ssowat/access.lua;

include conf.d/toto.fr.d/*.conf;

include conf.d/yunohost_admin.conf.inc;
include conf.d/yunohost_api.conf.inc;

access_log /var/log/nginx/toto.fr-access.log;
error_log /var/log/nginx/toto.fr-error.log;

}

Du coup que donne ll /etc/nginx/modules-enabled/ ?

madmaxlamenace > Le fichier de conf n’a pas de problèmes (si tu parles bien de ce qui est situé dans /etc/nginx/conf.d)

JimboJoe > Voici le résultat :

ls -ll /etc/nginx/modules-enabled
total 28
lrwxrwxrwx 1 root root 57 janv. 23 10:47 mod-http-auth-pam.conf -> /usr/share/nginx/modules-available/mod-http-auth-pam.conf
lrwxrwxrwx 1 root root 60 janv. 23 10:50 mod-http-cache-purge.conf -> /usr/share/nginx/modules-available/mod-http-cache-purge.conf
lrwxrwxrwx 1 root root 56 janv. 23 10:50 mod-http-dav-ext.conf -> /usr/share/nginx/modules-available/mod-http-dav-ext.conf
lrwxrwxrwx 1 root root 53 janv. 23 10:51 mod-http-echo.conf -> /usr/share/nginx/modules-available/mod-http-echo.conf
lrwxrwxrwx 1 root root 59 janv. 23 10:51 mod-http-fancyindex.conf -> /usr/share/nginx/modules-available/mod-http-fancyindex.conf
lrwxrwxrwx 1 root root 54 janv. 23 10:51 mod-http-geoip.conf -> /usr/share/nginx/modules-available/mod-http-geoip.conf
lrwxrwxrwx 1 root root 68 janv. 23 10:52 mod-http-headers-more-filter.conf -> /usr/share/nginx/modules-available/mod-http-headers-more-filter.conf
lrwxrwxrwx 1 root root 61 janv. 23 10:52 mod-http-image-filter.conf -> /usr/share/nginx/modules-available/mod-http-image-filter.conf
lrwxrwxrwx 1 root root 52 janv. 23 10:52 mod-http-lua.conf -> /usr/share/nginx/modules-available/mod-http-lua.conf
lrwxrwxrwx 1 root root 52 janv. 23 10:47 mod-http-ndk.conf -> /usr/share/nginx/modules-available/mod-http-ndk.conf
lrwxrwxrwx 1 root root 53 janv. 23 10:53 mod-http-perl.conf -> /usr/share/nginx/modules-available/mod-http-perl.conf
lrwxrwxrwx 1 root root 60 janv. 23 10:53 mod-http-subs-filter.conf -> /usr/share/nginx/modules-available/mod-http-subs-filter.conf
lrwxrwxrwx 1 root root 63 janv. 23 10:54 mod-http-uploadprogress.conf -> /usr/share/nginx/modules-available/mod-http-uploadprogress.conf
lrwxrwxrwx 1 root root 62 janv. 23 10:54 mod-http-upstream-fair.conf -> /usr/share/nginx/modules-available/mod-http-upstream-fair.conf
lrwxrwxrwx 1 root root 60 janv. 23 10:55 mod-http-xslt-filter.conf -> /usr/share/nginx/modules-available/mod-http-xslt-filter.conf
lrwxrwxrwx 1 root root 48 janv. 23 10:56 mod-mail.conf -> /usr/share/nginx/modules-available/mod-mail.conf
lrwxrwxrwx 1 root root 49 janv. 23 10:56 mod-nchan.conf -> /usr/share/nginx/modules-available/mod-nchan.conf
lrwxrwxrwx 1 root root 50 janv. 23 10:56 mod-stream.conf -> /usr/share/nginx/modules-available/mod-stream.conf

Peux-tu STP nous donner le contenu du fichier /etc/nginx/nginx.conf également ?

Yes ! :slight_smile: Le voici :

user www-data;
worker_processes 4;
pid /run/nginx.pid;

events {
        worker_connections 768;
        # multi_accept on;
}

http {

        ##
        # Basic Settings
        ##

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;
        # server_tokens off;
        client_max_body_size 2M;

        # server_names_hash_bucket_size 64;
        # server_name_in_redirect off;

        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        ##
        # SSL Settings
        ##

        ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
        ssl_prefer_server_ciphers on;

        ##
        # Logging Settings
        ##

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        ##
        # Gzip Settings
        ##

        gzip on;
        gzip_disable "msie6";

        # gzip_vary on;
        # gzip_proxied any;
        # gzip_comp_level 6;
        # gzip_buffers 16 8k;
        # gzip_http_version 1.1;
        # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

        ##
        # Virtual Host Configs
        ##

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
}


#mail {
#       # See sample authentication script at:
#       # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
#       # auth_http localhost/auth.php;
#       # pop3_capabilities "TOP" "USER";
#       # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
#       server {
#               listen     localhost:110;
#               protocol   pop3;
#               proxy      on;
#       }
#
#       server {
#               listen     localhost:143;
#               protocol   imap;
#               proxy      on;
#       }
#}

et /var/log/nginx/error.log ?