Last active
April 26, 2025 11:43
-
-
Save pstef/5ef5e6eec50628eb41b826f00565455a to your computer and use it in GitHub Desktop.
WebDAV for RetroArch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
192.168.5.1 webdav.local |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NOTE: you need to adjust paths and whatnot | |
# password is web/dav, use `htpasswd` or `openssl passwd` to re-generate nginx.users if you don't like plain text | |
user nginx nginx; | |
worker_processes 1; | |
pid /var/run/nginx.pid; | |
load_module /usr/lib/nginx/modules/ngx_http_dav_ext_module.so; | |
events { | |
worker_connections 16; | |
} | |
http { | |
include /etc/nginx/mime.types; | |
default_type application/octet-stream; | |
sendfile on; | |
keepalive_timeout 65; | |
limit_req_zone $binary_remote_addr zone=req_limit_zone:1m rate=5r/s; | |
limit_conn_zone $binary_remote_addr zone=conn_limit_zone:1m; | |
server { # the actual service | |
listen webdav.local:80; | |
server_name webdav.local; # only accept FQDN | |
location / { | |
root /mnt/microsd/webdav; # probably not the path that you want | |
dav_methods PUT DELETE MKCOL COPY MOVE; | |
dav_ext_methods PROPFIND OPTIONS LOCK UNLOCK; # currently no-op, module always sends full set | |
dav_access user:rw group:r; | |
auth_basic "WebDAV Access"; | |
auth_basic_user_file "/etc/nginx/nginx.users"; | |
# limits so that I do not DoS myself by accident | |
limit_req zone=req_limit_zone burst=10; | |
limit_conn conn_limit_zone 10; | |
limit_rate_after 10m; | |
limit_rate 2M; | |
client_max_body_size 1G; # not necessarily the limit you want | |
charset utf-8; | |
autoindex on; # let browsers browse and download contents | |
} | |
} | |
server { # redirect https to http; distributing certs for TLS would be needless PITA | |
listen webdav.local:443 ssl; | |
server_name webdav.local; | |
ssl_certificate /etc/nginx/conf.d/_lan.crt; | |
ssl_certificate_key /etc/nginx/conf.d/_lan.key; | |
access_log off; | |
return 301 http://$host$request_uri; | |
} | |
server { # 404 for fat fingers | |
listen webdav.local:80 default_server; | |
access_log off; | |
location / { | |
internal; | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
web:{PLAIN}dav |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Client (or server):
server: