-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf.docker
More file actions
53 lines (45 loc) · 1.42 KB
/
Copy pathnginx.conf.docker
File metadata and controls
53 lines (45 loc) · 1.42 KB
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
worker_processes 1;
error_log /var/log/nginx/error.log debug;
events {
worker_connections 1024;
}
http {
server_tokens off;
upstream back {
server target-nginx:80; # 配合用戶docker-compose的target-nginx
}
include mime.types;
default_type application/octet-stream;
server {
listen 80 default_server;
server_name localhost;
location / {
proxy_pass http://waf:8089; # Rust WAF
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_intercept_errors on;
error_page 403 = /waf_blocked;
error_page 502 = /waf_error;
error_page 400 404 500 503 504 = /custom_error;
}
location /backend {
internal;
rewrite /backend/(.*) /$1 break;
proxy_pass http://back;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_intercept_errors on;
error_page 400 403 404 500 502 503 504 = /custom_error;
}
location /waf_blocked {
return 403 "Forbidden: Request blocked by WAF";
}
location /waf_error {
return 502 "waf error";
}
location /custom_error {
return 404 "<html><body><h1>Oops! Something went wrong.</h1></body></html>";
}
}
}