-
Notifications
You must be signed in to change notification settings - Fork 141
/
nginx.conf
117 lines (94 loc) · 3.06 KB
/
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
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# For more information on configuration, see:
# * Official English Documentation: http://nginx.org/en/docs/
daemon off;
user nginx;
worker_processes auto;
error_log /dev/stderr info;
pid /run/nginx.pid;
events {
worker_connections 2048;
}
http {
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 /dev/stdout main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 69;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
map $http_accept $mirror_suffix {
default ".html";
"~*application/vnd\.pypi\.simple\.v1\+json" ".v1_json";
"~*application/vnd\.pypi\.simple\.v1\+html" ".v1_html";
"~*text/html" ".html";
}
# Uncomment the following lines to enable HTTPS
#server {
# listen 443 ssl;
# server_name banderx;
# ssl_certificate /etc/ssl/certs/nginx.crt;
# ssl_certificate_key /etc/ssl/private/nginx.key;
# root /data/pypi/web;
# autoindex on;
# charset utf-8;
# location /simple/ {
# index index$mirror_suffix;
# try_files $uri$mirror_suffix $uri $uri/ =404;
# }
# location /json/ {
# default_type application/json;
# }
# location /pypi/ {
# default_type application/json;
# }
# error_page 404 /404.html;
# location = /404.html {
# }
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# }
#}
# Uncomment the following lines to redirect HTTP to HTTPS
#server {
# listen 80;
# server_name banderx;
# return 301 https://$host$request_uri;
#}
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name banderx;
root /data/pypi/web;
autoindex on;
charset utf-8;
location /simple/ {
# Uncomment to support hash_index = true bandersnatch mirrors
# rewrite ^/simple/([^/])([^/]*)/$ /simple/$1/$1$2/ last;
# rewrite ^/simple/([^/])([^/]*)/([^/]+)$/ /simple/$1/$1$2/$3 last;
index index$mirror_suffix;
types {
application/vnd.pypi.simple.v1+json v1_json;
application/vnd.pypi.simple.v1+html v1_html;
text/html html;
}
try_files $uri$mirror_suffix $uri $uri/ =404;
}
# Let us set the correct mime type for all the JSON
location /json/ {
default_type application/json;
}
location /pypi/ {
default_type application/json;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
}