server {
    listen 80;
    server_name saas.niusenyun.com;  # 替换为您的域名

    access_log /var/log/nginx/malladmin_access.log;
    error_log /var/log/nginx/malladmin_error.log;

    root {{ deploy_path }}/backendui/dist-prod;
    index index.html;

    # Gzip 压缩配置
    gzip on;
    gzip_min_length 1k;
    gzip_buffers 16 64k;
    gzip_http_version 1.1;
    gzip_comp_level 4;
    gzip_types
        application/javascript
        application/x-javascript
        text/javascript
        text/css
        text/xml
        application/xhtml+xml
        application/xml
        application/json
        application/x-httpd-php
        application/x-yaml
        application/yaml
        application/vnd.ms-fontobject
        application/x-font-ttf
        font/opentype
        image/svg+xml
        image/x-icon
        text/plain;
    gzip_vary on;
    gzip_proxied any;
    gzip_disable "MSIE [1-6]\.";

    location / {
        try_files $uri $uri/ /index.html;
        #expires 7d;
        #add_header Cache-Control "public, no-transform";
    }

    # 静态资源缓存设置
    #location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
        #expires 30d;
        #add_header Cache-Control "public, no-transform";
    #}

    location /admin-api/ { ## 后端项目 - 管理后台
        proxy_pass http://localhost:48080/admin-api/; ## 重要！！！proxy_pass 需要设置为后端项目所在服务器的 IP
        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;
    }

    location /app-api/ { ## 后端项目 - 用户 App
        proxy_pass http://localhost:48080/app-api/; ## 重要！！！proxy_pass 需要设置为后端项目所在服务器的 IP
        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;
    }


    # 禁止访问隐藏文件
    location ~ /\. {
        deny all;
        access_log off;
        log_not_found off;
    }
}
