|
1 |
| -user nginx; |
2 |
| -worker_processes auto; |
3 |
| -pid /var/run/nginx.pid; |
4 |
| - |
5 |
| -events { |
6 |
| - worker_connections 1024; |
7 |
| -} |
8 |
| - |
9 |
| -http { |
10 |
| - |
11 |
| - ## |
12 |
| - # General Settings |
13 |
| - ## |
14 |
| - |
15 |
| - include /etc/nginx/mime.types; |
16 |
| - default_type application/octet-stream; |
17 |
| - server_tokens off; |
18 |
| - sendfile on; |
19 |
| - tcp_nopush on; |
20 |
| - tcp_nodelay on; |
21 |
| - keepalive_timeout 65; |
22 |
| - |
23 |
| - ## |
24 |
| - # Log Settings |
25 |
| - ## |
26 |
| - |
27 |
| - log_format main '$remote_addr - $remote_user [$time_local] "$request" ' |
28 |
| - '$status $body_bytes_sent "$http_referer" ' |
29 |
| - '"$http_user_agent" "$http_x_forwarded_for"'; |
30 |
| - access_log /var/log/nginx/access.log main; |
31 |
| - |
32 |
| - ## |
33 |
| - # API server |
34 |
| - ## |
35 |
| - |
36 |
| - limit_req_zone $binary_remote_addr zone=api:10m rate=1r/s; |
37 |
| - server { |
38 |
| - listen 5392; |
39 |
| - server_name _; |
40 |
| - root "/api/public"; |
41 |
| - index index.php; |
42 |
| - |
43 |
| - location / { |
44 |
| - try_files $uri @exphp; |
45 |
| - } |
46 |
| - |
47 |
| - error_page 404 /error/404.json; |
48 |
| - error_page 429 /error/429.json; |
49 |
| - |
50 |
| - location ^~ /error/ { |
51 |
| - internal; |
52 |
| - root /api/public; |
53 |
| - } |
54 |
| - |
55 |
| - limit_req zone=api; |
56 |
| - limit_req_status 429; |
57 |
| - limit_req_log_level warn; |
58 |
| - |
59 |
| - location @exphp { |
60 |
| - rewrite ^(.*)$ $1index.php last; |
61 |
| - } |
62 |
| - |
63 |
| - location ~ \.php$ { |
64 |
| - fastcgi_pass 127.0.0.1:9000; |
65 |
| - fastcgi_index index.php; |
66 |
| - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
67 |
| - fastcgi_split_path_info ^(.+\.php)(/.+)$; |
68 |
| - include fastcgi_params; |
69 |
| - try_files $uri =404; |
70 |
| - } |
71 |
| - } |
72 |
| - |
73 |
| - ## |
74 |
| - # Download server |
75 |
| - ## |
76 |
| - |
77 |
| - server { |
78 |
| - listen 5393; |
79 |
| - server_name _; |
80 |
| - root "/api/"; |
81 |
| - index Download.php; |
82 |
| - rewrite ^/(.*)+$ /Download.php?$1; |
83 |
| - location ~ \.php$ { |
84 |
| - fastcgi_pass 127.0.0.1:9000; |
85 |
| - fastcgi_index index.php; |
86 |
| - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
87 |
| - fastcgi_split_path_info ^(.+\.php)(/.+)$; |
88 |
| - include fastcgi_params; |
89 |
| - try_files $uri =404; |
90 |
| - } |
91 |
| - } |
92 |
| -} |
| 1 | +user nginx; |
| 2 | +worker_processes auto; |
| 3 | +pid /var/run/nginx.pid; |
| 4 | + |
| 5 | +events { |
| 6 | + worker_connections 1024; |
| 7 | +} |
| 8 | + |
| 9 | +http { |
| 10 | + |
| 11 | + ## |
| 12 | + # General Settings |
| 13 | + ## |
| 14 | + |
| 15 | + include /etc/nginx/mime.types; |
| 16 | + default_type application/octet-stream; |
| 17 | + server_tokens off; |
| 18 | + sendfile on; |
| 19 | + tcp_nopush on; |
| 20 | + tcp_nodelay on; |
| 21 | + keepalive_timeout 65; |
| 22 | + |
| 23 | + ## |
| 24 | + # Client Settings |
| 25 | + ## |
| 26 | + client_body_buffer_size 128M; |
| 27 | + client_max_body_size 128M; |
| 28 | + |
| 29 | + ## |
| 30 | + # Log Settings |
| 31 | + ## |
| 32 | + |
| 33 | + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' |
| 34 | + '$status $body_bytes_sent "$http_referer" ' |
| 35 | + '"$http_user_agent" "$http_x_forwarded_for"'; |
| 36 | + access_log /var/log/nginx/access.log main; |
| 37 | + |
| 38 | + ## |
| 39 | + # API server |
| 40 | + ## |
| 41 | + |
| 42 | + limit_req_zone $binary_remote_addr zone=api:10m rate=1r/s; |
| 43 | + server { |
| 44 | + listen 5392; |
| 45 | + server_name _; |
| 46 | + root "/api/public"; |
| 47 | + index index.php; |
| 48 | + |
| 49 | + location / { |
| 50 | + try_files $uri @exphp; |
| 51 | + } |
| 52 | + |
| 53 | + error_page 404 /error/404.json; |
| 54 | + error_page 429 /error/429.json; |
| 55 | + |
| 56 | + location ^~ /error/ { |
| 57 | + internal; |
| 58 | + root /api/public; |
| 59 | + } |
| 60 | + |
| 61 | + limit_req zone=api; |
| 62 | + limit_req_status 429; |
| 63 | + limit_req_log_level warn; |
| 64 | + |
| 65 | + location @exphp { |
| 66 | + rewrite ^(.*)$ $1index.php last; |
| 67 | + } |
| 68 | + |
| 69 | + location ~ \.php$ { |
| 70 | + fastcgi_pass 127.0.0.1:9000; |
| 71 | + fastcgi_index index.php; |
| 72 | + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
| 73 | + fastcgi_split_path_info ^(.+\.php)(/.+)$; |
| 74 | + include fastcgi_params; |
| 75 | + try_files $uri =404; |
| 76 | + } |
| 77 | + } |
| 78 | + |
| 79 | + ## |
| 80 | + # Download server |
| 81 | + ## |
| 82 | + |
| 83 | + server { |
| 84 | + listen 5393; |
| 85 | + server_name _; |
| 86 | + root "/api/"; |
| 87 | + index Download.php; |
| 88 | + rewrite ^/(.*)+$ /Download.php?$1; |
| 89 | + location ~ \.php$ { |
| 90 | + fastcgi_pass 127.0.0.1:9000; |
| 91 | + fastcgi_index index.php; |
| 92 | + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
| 93 | + fastcgi_split_path_info ^(.+\.php)(/.+)$; |
| 94 | + include fastcgi_params; |
| 95 | + try_files $uri =404; |
| 96 | + } |
| 97 | + } |
| 98 | +} |
0 commit comments