0x01 Installation
git clone --depth 1 https://github.com/heiher/nginx cd nginx git clone --depth 1 https://github.com/heiher/nginx-dav-ext-module ./auto/configure --prefix=/opt/nginx \ --with-compat \ --with-file-aio \ --with-http_addition_module \ --with-http_auth_request_module \ --with-http_dav_module \ --with-http_degradation_module \ --with-http_flv_module \ --with-http_geoip_module \ --with-http_gunzip_module \ --with-http_gzip_static_module \ --with-http_mp4_module \ --with-http_realip_module \ --with-http_secure_link_module \ --with-http_slice_module \ --with-http_ssl_module \ --with-http_stub_status_module \ --with-http_sub_module \ --with-http_v2_module \ --with-pcre-jit \ --with-threads \ --add-module=nginx-dav-ext-module make sudo make install |
0x02 Configuration
Main: /opt/nginx/conf/nginx.conf:
#user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; dav_ext_lock_zone zone=foo:10m; server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; auth_basic Restricted; auth_basic_user_file htpasswd; dav_methods PUT DELETE MKCOL COPY MOVE; dav_ext_methods PROPFIND PROPPATCH OPTIONS LOCK UNLOCK; dav_ext_lock zone=foo; dav_access user:rw group:rw all:r; client_max_body_size 0; create_full_put_path on; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } } |
Auth: /opt/nginx/conf/htpasswd:
htpasswd -b -c /opt/nginx/conf/htpasswd YOUR_USERNAME YOUR_PASSWORD |
Start, Stop and Reload:
# Start sudo /opt/nginx/sbin/nginx # Stop sudo /opt/nginx/sbin/nginx -s stop # Reload sudo /opt/nginx/sbin/nginx -s reload |
Windows 10
Fix authentication and file size limits, open regedit and modify:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters\ BasicAuthLevel = 2 FileSizeLimitInBytes = 0xffffffff |
Over!