chore: 调整 Dockerfile 构造
This commit is contained in:
@@ -1,123 +1,98 @@
|
||||
|
||||
#user nobody;
|
||||
worker_processes 1;
|
||||
|
||||
#error_log logs/error.log;
|
||||
#error_log logs/error.log notice;
|
||||
#error_log logs/error.log info;
|
||||
|
||||
#pid logs/nginx.pid;
|
||||
|
||||
worker_processes auto;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
sendfile on;
|
||||
# tcp_nopush on;
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
client_max_body_size 500m;
|
||||
|
||||
#keepalive_timeout 0;
|
||||
# keepalive_timeout 65;
|
||||
|
||||
# gzip on;
|
||||
# gzip_buffers 32 16k;
|
||||
# gzip_comp_level 6;
|
||||
# gzip_min_length 1k;
|
||||
# gzip_static on;
|
||||
# gzip_types text/plain
|
||||
# text/css
|
||||
# application/javascript
|
||||
# application/json
|
||||
# application/x-javascript
|
||||
# text/xml
|
||||
# application/xml
|
||||
# application/xml+rss
|
||||
# text/javascript; #设置压缩的文件类型
|
||||
# gzip_vary on;
|
||||
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
|
||||
# 如需多机负载均衡,在此增加多个后端地址
|
||||
upstream easyflow_api {
|
||||
server easyflow-api:8080;
|
||||
keepalive 64;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 8080;
|
||||
server_name localhost;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
index index.html;
|
||||
# Enable CORS
|
||||
add_header 'Access-Control-Allow-Origin' '*';
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header 'Access-Control-Max-Age' 1728000;
|
||||
add_header 'Content-Type' 'text/plain charset=UTF-8';
|
||||
add_header 'Content-Length' 0;
|
||||
return 204;
|
||||
}
|
||||
map $http_upgrade $connection_upgrade {
|
||||
default upgrade;
|
||||
'' close;
|
||||
}
|
||||
|
||||
# WebSocket(语音链路)
|
||||
location /api/v1/bot/ws/audio {
|
||||
proxy_pass http://easyflow_api;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
}
|
||||
resolver 127.0.0.11 valid=30s ipv6=off;
|
||||
|
||||
# SSE/HTTP API
|
||||
location /api/ {
|
||||
proxy_pass http://easyflow_api;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
proxy_buffering off;
|
||||
proxy_cache off;
|
||||
}
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
location /userCenter/ {
|
||||
proxy_pass http://easyflow_api;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
proxy_buffering off;
|
||||
proxy_cache off;
|
||||
}
|
||||
location = / {
|
||||
return 302 /flow/;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /flow {
|
||||
return 301 /flow/;
|
||||
}
|
||||
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
location = /flow/api {
|
||||
return 301 /flow/api/;
|
||||
}
|
||||
|
||||
location = /flow/storage {
|
||||
return 301 /flow/storage/;
|
||||
}
|
||||
|
||||
location = /flow/api/v1/bot/ws/audio {
|
||||
set $easyflow_backend http://backend:8111;
|
||||
rewrite ^/flow/(.*)$ /$1 break;
|
||||
proxy_pass $easyflow_backend;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Port $server_port;
|
||||
proxy_set_header X-Forwarded-Prefix /flow;
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
proxy_redirect off;
|
||||
}
|
||||
|
||||
location ^~ /flow/api/ {
|
||||
set $easyflow_backend http://backend:8111;
|
||||
rewrite ^/flow/api/(.*)$ /api/$1 break;
|
||||
proxy_pass $easyflow_backend;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Port $server_port;
|
||||
proxy_set_header X-Forwarded-Prefix /flow;
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
proxy_buffering off;
|
||||
proxy_cache off;
|
||||
proxy_redirect off;
|
||||
}
|
||||
|
||||
location ^~ /flow/storage/ {
|
||||
set $easyflow_minio http://minio-shared:9000;
|
||||
rewrite ^/flow/storage/(.*)$ /easyflow/$1 break;
|
||||
proxy_pass $easyflow_minio;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_redirect off;
|
||||
}
|
||||
|
||||
location ^~ /flow/ {
|
||||
root /usr/share/nginx/html;
|
||||
try_files $uri $uri/ /flow/index.html;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user