-
Notifications
You must be signed in to change notification settings - Fork 43
/
nginx.conf.example
43 lines (36 loc) · 1.28 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
# Example of an Nginx configuration for Simple NuGet Server
server {
server_name example.com;
root /var/www/simple-nuget-server/public/;
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$ {
include fastcgi_params;
fastcgi_pass php;
}
location = /index.php {
dav_methods PUT DELETE;
include fastcgi_params;
fastcgi_pass php;
# 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/;
}
}