123 lines
3.1 KiB
Nginx Configuration File
123 lines
3.1 KiB
Nginx Configuration File
|
|
client_max_body_size 50m;
|
||
|
|
|
||
|
|
map $http_upgrade $connection_upgrade {
|
||
|
|
default upgrade;
|
||
|
|
'' close;
|
||
|
|
}
|
||
|
|
|
||
|
|
server {
|
||
|
|
listen 80;
|
||
|
|
listen 443 ssl http2;
|
||
|
|
server_name pc.domain;
|
||
|
|
root /app/frontend;
|
||
|
|
|
||
|
|
gzip on;
|
||
|
|
gzip_static on;
|
||
|
|
gzip_buffers 4 16k;
|
||
|
|
gzip_http_version 1.1;
|
||
|
|
gzip_comp_level 5;
|
||
|
|
gzip_types text/plain application/javascript text/css application/xml text/javascript;
|
||
|
|
gzip_vary on;
|
||
|
|
|
||
|
|
location /api/ {
|
||
|
|
proxy_set_header X-Real-IP $remote_addr;
|
||
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
|
|
proxy_pass http://127.0.0.1:9898/;
|
||
|
|
}
|
||
|
|
|
||
|
|
location ~* ^/((?!api|template).*) {
|
||
|
|
try_files $uri $uri/ /index.html;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
server {
|
||
|
|
listen 80;
|
||
|
|
listen 443 ssl http2;
|
||
|
|
server_name h5.domain;
|
||
|
|
root /app/h5;
|
||
|
|
index index.html;
|
||
|
|
|
||
|
|
gzip on;
|
||
|
|
gzip_static on;
|
||
|
|
gzip_buffers 4 16k;
|
||
|
|
gzip_http_version 1.1;
|
||
|
|
gzip_comp_level 5;
|
||
|
|
gzip_types text/plain application/javascript text/css application/xml text/javascript;
|
||
|
|
gzip_vary on;
|
||
|
|
|
||
|
|
location /api/ {
|
||
|
|
proxy_set_header X-Real-IP $remote_addr;
|
||
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
|
|
proxy_pass http://127.0.0.1:9898/;
|
||
|
|
}
|
||
|
|
|
||
|
|
location ~* ^/((?!api|template).*) {
|
||
|
|
try_files $uri $uri/ /index.html;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
server {
|
||
|
|
listen 80;
|
||
|
|
listen 443 ssl http2;
|
||
|
|
server_name admin.domain;
|
||
|
|
root /app/backend;
|
||
|
|
index index.html;
|
||
|
|
|
||
|
|
gzip on;
|
||
|
|
gzip_static on;
|
||
|
|
gzip_buffers 4 16k;
|
||
|
|
gzip_http_version 1.1;
|
||
|
|
gzip_comp_level 5;
|
||
|
|
gzip_types text/plain application/javascript text/css application/xml text/javascript;
|
||
|
|
gzip_vary on;
|
||
|
|
|
||
|
|
location /api/ {
|
||
|
|
proxy_set_header X-Real-IP $remote_addr;
|
||
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
|
|
proxy_pass http://127.0.0.1:9898/;
|
||
|
|
}
|
||
|
|
|
||
|
|
location ~* ^/((?!api|template).*) {
|
||
|
|
try_files $uri $uri/ /index.html;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
server {
|
||
|
|
listen 80;
|
||
|
|
listen 443 ssl http2;
|
||
|
|
server_name api.domain;
|
||
|
|
root /app/api;
|
||
|
|
index index.html;
|
||
|
|
location /speechrec/{
|
||
|
|
proxy_pass https://nls-gateway-cn-shenzhen.aliyuncs.com/;
|
||
|
|
# 跨域配置
|
||
|
|
add_header 'Access-Control-Allow-Origin' '*' always; # 允许所有源访问
|
||
|
|
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE' always;
|
||
|
|
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization' always;
|
||
|
|
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
|
||
|
|
if ($request_method = 'OPTIONS') {
|
||
|
|
return 204; # 预检请求无需返回内容
|
||
|
|
}
|
||
|
|
proxy_set_header Host nls-gateway-cn-shenzhen.aliyuncs.com;
|
||
|
|
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_connect_timeout 30s;
|
||
|
|
proxy_send_timeout 60s;
|
||
|
|
proxy_read_timeout 60s;
|
||
|
|
|
||
|
|
}
|
||
|
|
location / {
|
||
|
|
proxy_set_header X-Real-IP $remote_addr;
|
||
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
|
|
proxy_pass http://127.0.0.1:9898/;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
####MINIO-START####
|
||
|
|
####MINIO-END####
|