This repository has been archived by the owner on Mar 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.conf
64 lines (55 loc) · 1.54 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
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream websocket {
server board:8080;
}
server {
index index.php;
root /var/www/html;
location ~ ^/websocket$ {
proxy_connect_timeout 7d;
proxy_send_timeout 7d;
proxy_read_timeout 7d;
proxy_pass http://websocket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
location ~ ^/server\.php(/|$) {
fastcgi_pass server:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /var/www/html/public/index.php;
fastcgi_param PATH_INFO $fastcgi_path_info;
internal;
}
location ~ ^/board\.php(/|$) {
fastcgi_pass board:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /var/www/html/public/index.php;
fastcgi_param PATH_INFO $fastcgi_path_info;
internal;
}
set $redirectApi "";
if ($http_referer ~* /api/doc ) {
set $redirectApi R;
}
if ($request_uri !~* /api/) {
set $redirectApi "${redirectApi}A";
}
if ($redirectApi = RA) {
return 301 $scheme://$host/api$request_uri;
}
location ~ ^/api(.*)$ {
try_files /server$1 /server.php$is_args$args;
}
location ~ ^(.*)$ {
try_files /board$1 /board.php$is_args$args;
}
location ~ \.php$ {
return 404;
}
}