webdav mit nginx

berni51

Open-Net-FreeBSD user
Nachdem mein neuer Backup-Server seine TB ja schon via nfs und ftp bereitstellt, wollte ich noch den Zugang per webdav einrichten. Ein Webserver unter FreebSD läuft ja bereits im Netz mit nginx.
Also schnell einen nginx aufgesetzt - aber halt, dem fehlen ja die Webdav-Module. Also aus den ports neu gebaut mit den benötigten Modulen.
Ein nginx -V zeigt jetzt:

Code:
nginx version: nginx/1.20.2
built with OpenSSL 1.1.1k-freebsd  24 Aug 2021
TLS SNI support enabled
configure arguments: --prefix=/usr/local/etc/nginx --with-cc-opt='-I /usr/local/include' --with-ld-opt='-L /usr/local/lib' --conf-path=/usr/local/etc/nginx/nginx.conf --sbin-path=/usr/local/sbin/nginx --pid-path=/var/run/nginx.pid --error-log-path=/var/log/nginx/error.log --user=www --group=www --with-compat --modules-path=/usr/local/libexec/nginx --with-file-aio --http-client-body-temp-path=/var/tmp/nginx/client_body_temp --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi_temp --http-proxy-temp-path=/var/tmp/nginx/proxy_temp --http-scgi-temp-path=/var/tmp/nginx/scgi_temp --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi_temp --http-log-path=/var/log/nginx/access.log --with-http_v2_module --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-pcre --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --without-mail_imap_module --without-mail_pop3_module --without-mail_smtp_module --with-mail_ssl_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-threads --with-mail=dynamic --with-stream=dynamic --add-dynamic-module=/usr/ports/www/nginx/work/nginx-dav-ext-module-3.0.0 --add-dynamic-module=/usr/ports/www/nginx/work/ngx_http_geoip2_module-3.3

Sieht für mich jetzt erstmal korrekt aus.

Kurz eine minimalistische nginx.conf erstellt:

Code:
events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
     sendfile        on;
    keepalive_timeout  65;

    server {
        listen       80;
        server_name  localhost;
       root /usr/local/www;
       
               location / {
            index  index.html index.htm;
        }

        error_page   500 502 503 504  /50x.html;
        
location = /50x.html {
            root   /usr/local/www/nginx-dist;
        }

    location /webdav {

        dav_methods     PUT DELETE MKCOL COPY MOVE;
        dav_ext_methods   PROPFIND OPTIONS;
        create_full_put_path  on;
        dav_access    user:rw group:rw all:rw;
        autoindex     on;
        limit_except GET PROPFIND OPTIONS{
          allow 192.168.0.0/24;
          allow  all;
        }

}
}

Wenn ich diese Konfiguration mit nginx -t teste, falle ich durch, weil die Directriven der dav_ext_methods nicht bekannt sind - obwohl der nginx damit gebaut wurde.
Kommentiere ich die entsprechende Stelle aus, wird die Konfiguration als gut befunden.

Allerdings kann ich damit keine webdav-Verbindung aufbauen. Eine http-Verbindung ist kein Problem, aber die brauch ich ja nicht. Mein test tool (cadaver) gibt aus:

Code:
berni@macfake [~] $ cadaver localhost
Could not open collection:
405 Not Allowed
dav:/?

Gebe ich ein: cadaver localhost/webdav (was meiner Meinung nach korrekt ist), ist die Ausgabe:

Code:
berni@macfake [~] $ cadaver localhost/webdav
Could not parse URL `localhost/webdav'
dav:localhost/webdav? quit

Also auch keine Verbindung.
Irgendwas mache ich falsch - aber was?
Irgend eine Idee?

Berni, schon wieder ratlos
 
Probiere folgendes mal am Anfang der nginx.conf aus, wie double-p vorgeschlagen hat:

Code:
load_module /usr/local/libexec/nginx/ngx_http_dav_ext_module.so;
 
Ja, ihr hattet recht: Das Modul muss geladen werden. Hatte ich erst gar nicht kapiert.
Besten Dank euch beiden, so klappts.
 
Zurück
Oben