มีแอปพลิเคชันเชิงมุมมากกว่า 1 รายการที่ให้บริการโดยพร็อกซีย้อนกลับ nginx เดียว นี่คือการกำหนดค่าของฉันที่ฉันลอง
ผู้ปฏิบัติงาน_กระบวนการ 1;
error_log <%= ENV["APP_ROOT"] %>/nginx/logs/error.log;
เหตุการณ์ { worker_connections 1024; }
http {
    client_max_body_size 3G;
    
    
    log_format upstream_time '$remote_addr - $remote_user [$time_local]'
                             '"$คำขอ" $สถานะ $body_bytes_sent '
                             '"$http_referer" "$http_user_agent" '
                             'rt="$request_time" uct="$upstream_connect_time" uht="$upstream_header_time" urt="$upstream_response_time" ua="$upstream_addr" ';
                             
    access_log <%= ENV["APP_ROOT"] %>/nginx/logs/access.log upstream_time;  
        
    เซิร์ฟเวอร์ {
        ฟัง <%= ENV["PORT"] %>;
        server_name localhost;
        รูท <%= ENV["APP_ROOT"] %>/สาธารณะ;
        
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-ส่งต่อ-สำหรับ $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_http_version 1.1;
        
        #สปริงบูตไมโครเซอร์วิส
        ตำแหน่ง /monitoringserv/details/ {
            <% ถ้า ENV["FORCE_HTTPS"] %>
                ถ้า ($http_x_forwarded_proto != "https") {
                ส่งคืน 301 https://$host$request_uri;
                }
            <% จบ %>           
            proxy_pass https://monitoring-c-serv.apps-dev.net;
            }
        
        ตำแหน่ง /dashboardserv/คิว/ {
            <% ถ้า ENV["FORCE_HTTPS"] %>
                ถ้า ($http_x_forwarded_proto != "https") {
                ส่งคืน 301 https://$host$request_uri;
                }
            <% จบ %>           
            proxy_pass https://dashboard-c-serv.apps-dev.net;
            }
                
        #default หน้า Landing Page ของ UI
        ตำแหน่ง ~ .(html|js|css|eot|svg|ttf|woff|woff2|png|gif|ico|jpg|jpeg)$ {                                    
            proxy_pass https://dashboard.apps-dev.net;
        }
                                
        ตำแหน่ง ~ ^/admin/.*\.(html|js|css|eot|svg|ttf|woff|woff2|png|gif|ico|jpg|jpeg)$ {
                try_files $request_uri $request_uri/ =404;  
        }
        ตำแหน่ง ~ ^/monitoring/.*\.(html|js|css|eot|svg|ttf|woff|woff2|png|gif|ico|jpg|jpeg)$ {    
                try_files $request_uri $request_uri/ =404;  
        }
                        
        #1-URL UI เริ่มต้น
        ที่ตั้ง / {            
            proxy_pass https://dashboard.apps-dev.net;
        }
        
        ตำแหน่ง /admin/ {          
            proxy_pass https://admin.apps-dev.net;;
        }
        
        ตำแหน่ง /การตรวจสอบ/ {         
            proxy_pass https://monitoring.apps-dev.net;;
        }
    }
}
สร้างแอปพลิเคชันเชิงมุมด้วย
ng สร้าง --prod --base-href /admin/
ng สร้าง --prod --base-href /monitoring/
เมื่อฉันเปิดแอปแดชบอร์ดของแอปพลิเคชันเปิดได้ดีและเมื่อฉันโหลดผู้ดูแลระบบหรือการตรวจสอบ ฉันได้รับข้อผิดพลาดแจ้งว่าไฟล์สแตติกขาดหายไป