-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhttp.conf
239 lines (214 loc) · 6.9 KB
/
http.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
client_max_body_size 50m;
# # http://nginx.org/en/docs/http/ngx_http_core_module.html#client_header_buffer_size
# client_header_buffer_size 128k;
# large_client_header_buffers 4 128k;
proxy_buffer_size 512k;
proxy_buffers 8 512k;
proxy_busy_buffers_size 512k;
proxy_temp_file_write_size 512k;
log_format json '{"@timestamp":"$time_iso8601","host":"$server_addr","client":"$remote_addr","size":$body_bytes_sent,'
'"responsetime":$request_time,"url":"$uri","referer":"$http_referer",'
'"agent":"$http_user_agent","backend":"$upstream_addr","status":"$status"}';
# upstream to_http {
# server 10.0.0.2:8080;
# }
#
# upstream to_https {
# server 10.0.0.2:8443;
# }
#
# upstream downloadapi {
# # hash $http_<header> consistent;
# # hash $proxy_protocol_addr consistent; # proxy_protocol
# server 172.17.0.1:8088;
# server 192.168.1.2:8088;
# server 192.168.1.3:8088;
# keepalive 64;
# }
# # perl_set $rename_dest '
# # sub {
# # my $r = shift;
# # my $encode_url = $r->header_in(destination);
# # $encode_url =~ s/^https/http/;
# # $encode_url =~ s/%25/%/g;
# # return $encode_url;
# # }
# # ';
#
# map $http_destination $move_destination {
# ~^https://(.+) http://$1;
# default $http_destination;
# }
server {
listen 80;
listen [::]:80;
# listen 443 ssl http2;
# listen 443 ssl http2 proxy_protocol; # for stream realip
# listen [::]:443 ssl http2;
server_name localhost;
# error_page 497 301 https://$http_host$request_uri; # $host + ':$port' = $http_host
# if ($ssl_protocol = "") {
# return 301 https://$host$request_uri;
# }
# if ($request_method ~* OPTIONS|TRACE) {
# return 403;
# }
# ssl_certificate /etc/ssl/letsencrypt/live/$ssl_server_name/fullchain.pem;
# ssl_certificate_key /etc/ssl/letsencrypt/live/$ssl_server_name/privkey.pem;
add_header X-Frame-Options SAMEORIGIN;
#charset koi8-r;
#access_log /var/log/nginx/http.access.log json;
location / {
if (-d $request_filename) {
rewrite ^/(.*)([^/])$ $scheme://$host/$1$2/ permanent;
}
root /var/run/www;
index index.html index.htm;
}
# location / {
# root /var/run/www;
# index index.html;
# try_files $uri $uri/index.html $uri.html @to;
# # gzip_static on;
# }
#
# location @to {
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# # proxy_set_header Host $http_host;
# proxy_set_header X-Nginx-Proxy true;
#
# # websocket
# proxy_set_header Upgrade $http_upgrade;
# proxy_http_version 1.1;
# proxy_set_header Connection "upgrade";
#
# proxy_pass $scheme://to_$scheme;
# }
# location ~ ^/prefix-(suffix-1|suffix-2)/ {
# root /data;
# autoindex off;
# if (-d $request_filename) {
# rewrite [^/]$ $scheme://$http_host$uri/ permanent;
# }
# }
# location ^~ /upstream/ {
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# # proxy_set_header Host $http_host;
# proxy_set_header X-Nginx-Proxy true;
# proxy_set_header Connection "";
# proxy_pass http://upstream;
# }
# location ^~ /uml/ {
# proxy_set_header Accept-Encoding ''; # no compression
# sub_filter_types *;
# sub_filter_once off;
# sub_filter '="/' '="/uml/';
# sub_filter 'http://10.0.0.2:8008/' 'https://$host/uml/';
#
# # rewrite / /info redirect;
#
# # # https://localhost/param -> http://10.0.0.2:8008/param
# # proxy_pass http://10.0.0.2:8008;
#
# # # https://localhost/param -> http://10.0.0.2:8008
# proxy_pass http://10.0.0.2:8008/;
#
# proxy_redirect /new/ /uml/new/; # replace response header : 'location' or 'refresh': /new/ -> /uml/new/
#
# # proxy_redirect http:// https://;
# }
# location / {
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#
# # must be in the PEM format
# proxy_ssl_trusted_certificate /etc/ssl/certs/backend.example.com/trusted_ca_cert.crt;
# proxy_ssl_verify on;
# proxy_ssl_verify_depth 2;
#
# proxy_set_header X-Nginx-Proxy true;
# proxy_set_header Connection "";
# proxy_pass https://backend.example.com;
# }
# location ^~ /svn_or_webdav {
#
# # set $move_method_dest $http_destination;
# # if ($http_destination ~ "^https://(.+)") {
# # # set $move_method_dest http://$1;
# # set $move_method_dest $rename_dest;
# # }
# # proxy_set_header Destination $move_method_dest;
#
# proxy_buffering off;
# proxy_read_timeout 600;
# proxy_send_timeout 600;
#
# proxy_set_header Destination $move_destination;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header Host $http_host;
# proxy_set_header X-Nginx-Proxy true;
# proxy_set_header Connection "";
# proxy_pass http://subversion.example.com;
# }
# location ~ ^/sub/ {
# # # https://localhost/sub/path -> /var/run/www/path
# # alias /var/run/www/;
#
# # https://localhost/sub/path -> /var/run/www/sub/path
# root /var/run/www/;
# }
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/run/www;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
#! XJAR_ROOTS= XJAR_INCLUDE= XJAR_IGNORE=;
}
# # HTTP can be used for accessing RTMP stats
# server {
#
# listen 8080;
#
# # This URL provides RTMP statistics in XML
# location /stat {
# rtmp_stat all;
#
# # Use this stylesheet to view XML as web page
# # in browser
# rtmp_stat_stylesheet stat.xsl;
# }
#
# location /stat.xsl {
# # XML stylesheet to view RTMP stats.
# # Copy stat.xsl wherever you want
# # and put the full directory path here
# root /path/to/stat.xsl/;
# }
#
# location /hls {
# # Serve HLS fragments
# types {
# application/vnd.apple.mpegurl m3u8;
# video/mp2t ts;
# }
# root /tmp;
# add_header Cache-Control no-cache;
# }
#
# location /dash {
# # Serve DASH fragments
# root /tmp;
# add_header Cache-Control no-cache;
# }
# }