nginx配置

#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;
        }

    }
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值