-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
40 lines (32 loc) · 990 Bytes
/
nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
worker_processes auto;
events {
worker_connections 1024;
}
http {
server {
listen 80;
root /var/packages;
autoindex on;
autoindex_exact_size off;
location /packages/ {
# Allow read access to everyone
autoindex on;
}
# Upload endpoint with path rewrite
location /upload/ {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htpasswd;
client_max_body_size 100m;
# Rewrite the URL to remove "/upload" and append "/packages" to the path
rewrite ^/upload(/.*)$ /packages$1 break;
# Save uploaded files in the correct path
dav_methods PUT DELETE;
create_full_put_path on;
dav_access group:rw all:r;
root /var/packages;
# Permissions
client_body_temp_path /tmp/nginx-client-body;
client_body_in_file_only clean;
}
}
}