-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathnginx.conf.example
69 lines (59 loc) · 2.38 KB
/
nginx.conf.example
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Example of an Nginx configuration for Simple NuGet Server
server {
server_name localhost;
listen 80 default backlog=1024;
root /var/www/simple-nuget-server/public/;
client_body_buffer_size 5M;
client_header_buffer_size 4k;
open_file_cache max=65535 inactive=60s;
open_file_cache_valid 60s;
open_file_cache_min_uses 1;
open_file_cache_errors on;
rewrite ^/$ /index.php;
rewrite ^/\$metadata$ /metadata.xml;
rewrite ^/Search\(\)/\$count$ /count.php;
rewrite ^/Search\(\)$ /search.php;
rewrite ^/Packages\(\)$ /search.php;
rewrite ^/Packages\(Id='([^']+)',Version='([^']+)'\)$ /findByID.php?id=$1&version=$2;
rewrite ^/GetUpdates\(\)$ /updates.php;
rewrite ^/FindPackagesById\(\)$ /findByID.php;
# NuGet.exe sometimes uses two slashes (//download/blah)
rewrite ^//?download/([^/]+)/([^/]+)$ /download.php?id=$1&version=$2;
rewrite ^/([^/]+)/([^/]+)$ /delete.php?id=$1&version=$2;
# NuGet.exe adds /api/v2/ to URL when the server is at the root
rewrite ^/api/v2/package/$ /index.php;
rewrite ^/api/v2/package/([^/]+)/([^/]+)$ /delete.php?id=$1&version=$2;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm.sock;
fastcgi_index index.php;
fastcgi_buffers 4 1024k;
fastcgi_buffer_size 1024k;
fastcgi_busy_buffers_size 1024k;
fastcgi_temp_file_write_size 5M;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location = /index.php {
dav_methods PUT DELETE;
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm.sock;
fastcgi_index index.php;
fastcgi_buffers 4 1024k;
fastcgi_buffer_size 1024k;
fastcgi_busy_buffers_size 1024k;
fastcgi_temp_file_write_size 5M;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
# PHP doesn't parse request body for PUT requests, so fake a POST.
fastcgi_param REQUEST_METHOD POST;
fastcgi_param HTTP_X_METHOD_OVERRIDE $request_method;
}
# Used with X-Accel-Redirect
location /packagefiles {
internal;
root /var/www/simple-nuget-server/;
}
}