Files
molly-multi-tenant/nginx.conf
2024-04-21 11:05:20 +08:00

64 lines
1.9 KiB
Nginx Configuration File

#user nobody;
worker_processes 4;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 10240;
}
http {
include mime.types;
default_type application/octet-stream;
charset utf-8;
server_tokens off;
sendfile on;
keepalive_timeout 65;
client_max_body_size 20M;
gzip on; ## 开启压缩
gzip_vary on;
gzip_proxied any; ## 为所有代理请求启用压缩
gzip_min_length 1024; ## 设置将被gzip压缩的响应的最小长度
gzip_comp_level 6; ## 设置压缩等级
gzip_buffers 16 8k; ## 设置用于压缩响应的缓冲区number和size
gzip_proxied expired no-cache no-store private auth no_last_modified no_etag;
gzip_types text/plain application/x-javascript text/css application/xml application/json;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
add_header X-Xss-Protection 1;
server {
listen 80;
server_name localhost;
location / {
root /html/tenant;
index index.html;
}
location /platform {
alias /html/platform;
index index.html;
}
location /api {
rewrite ^/api/(.*)$ /$1 break;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# docker 环境下使用 proxy_pass http://molly:18891/;
proxy_pass http://127.0.0.1:18891/;
}
}
}