#user nobody;
worker_processes 8;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#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 logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
client_max_body_size 500m;
#gzip on;
upstream digigd-admin {
server 10.7.4.10:5731;
}
upstream digigd-user {
server 10.7.4.10:5530;
}
upstream digigd-resource {
server 10.7.4.10:5533;
}
upstream digigd-open {
server 10.7.4.10:5500;
}
server {
listen *:80;
server_name localhost;
server_tokens off; ## Don't show the nginx version number, a security best practice
add_header Strict-Transport-Security "max-age=31536000";
add_header Referrer-Policy strict-origin-when-cross-origin;
if ($http_host != "") {
set $http_host_with_default $http_host;
}
gzip on;
# gzip_static on;
gzip_comp_level 2;
gzip_http_version 1.1;
gzip_vary on;
gzip_disable "msie6";
gzip_min_length 10240;
gzip_proxied no-cache no-store private expired auth;
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/json application/xml application/rss+xml;
proxy_read_timeout 3600;
proxy_connect_timeout 300;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Host $http_host_with_default;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Forwarded-Proto http;
#client_max_body_size 500m; # 控制该server的所有请求报文大小
#location ~ (.git/git-receive-pack$|.git/info/refs?service=git-receive-pack$|.git/gitlab-lfs/objects|.git/info/lfs/objects/batch$) {
# proxy_cache off;
# proxy_pass http://gitlab-workhorse;
# proxy_request_buffering off;
#}
location / {
alias /usr/share/nginx/html/dist;
try_files $uri $uri/ /dist/index.html;
}
location /marketAdmin {
alias /usr/share/nginx/html/marketAdmin;
try_files $uri $uri/ /marketAdmin/index.html;
}
location /marketClient {
alias /usr/share/nginx/html/marketClient;
try_files $uri $uri/ /marketClient/index.html;
}
location ~ .*\.(woff|ttf|jpg|jpeg|gif|png|ico|css|js|pdf|txt)$ {
root /usr/share/nginx/html;
proxy_temp_path /usr/share/nginx/html;
}
location /admin/ {
rewrite ^/admin/(.*) /$1 break;
proxy_cache off;
proxy_pass http://digigd-admin;
}
location /gateway/openapi/ {
rewrite ^/gateway/openapi/(.*) /$1 break;
proxy_cache off;
proxy_pass http://digigd-open;
}
location /gateway/user/ {
rewrite ^/gateway/user/(.*) /$1 break;
proxy_cache off;
proxy_pass http://digigd-user;
}
location /gateway/resource/ {
rewrite ^/gateway/resource/(.*) /$1 break;
proxy_cache off;
proxy_pass http://digigd-resource;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}
nginx配置
最新推荐文章于 2025-05-13 10:00:42 发布