主应用配置
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 4096;
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;
server {
listen 80;
listen [::]:80;
server_name _;
root /usr/share/nginx/html;
include /etc/nginx/default.d/*.conf;
error_page 404 /404.html;
location = /404.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
server {
listen 8080;
listen [::]:8080;
server_name fs_h5_server;
gzip on;
gzip_min_length 1k;
gzip_comp_level 5;
gzip_types text/plain text/css application/json application/javascript text/javascript image/svg+xml;
gzip_vary on;
include /etc/nginx/fs.conf.d/*.conf;
error_page 404 /404.html;
location = /404.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
// 所有子应用公用代理端口
location /api/v1 {
proxy_pass http://192.168.18.151:8082;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /fs-api/ {
rewrite ^/fs-api/(.*)$ /$1 break;
proxy_pass https://open.feishu.cn;
proxy_set_header Host open.feishu.cn;
proxy_ssl_server_name on;
proxy_ssl_protocols TLSv1.2 TLSv1.3;
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;
}
}
}
子应用配置
子应用配置1
location /xxx/ {
alias /usr/local/nginx/html/xxx/;
index index.html;
try_files $uri $uri/ /xxx/index.html;
expires 30d;
add_header Cache-Control "public, no-transform";
if ($request_filename ~* \.(html|htm)$) {
expires -1;
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
}
子应用配置2
location /xxx/ {
alias /usr/local/nginx/html/xxx/;
index index.html;
try_files $uri $uri/ /xxx/index.html;
expires 30d;
add_header Cache-Control "public, no-transform";
if ($request_filename ~* \.(html|htm)$) {
expires -1;
add_header Cache-Control "no-cache, no-store, must-revalidate";
}
}
location /fin360api {
proxy_pass https://xxx.cn;
proxy_set_header Host xxx.cn;
proxy_ssl_server_name on;
proxy_ssl_name xxx.cn;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}