nginx 代理eureka后css/js/fonts无法访问

nginx 代理eureka后css/js/fonts无法访问,页面没有样式

server {
    listen 80;
    server_name your_domain.com;

    location /eureka {
        proxy_pass http://eureka_server_ip:8761;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

        # Handle static resources under /eureka
        location ~ ^/eureka/(css|js|images|fonts)/ {
            proxy_pass http://eureka_server_ip:8761;
            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
        }

        # Rewrite the base URL to include /eureka
        rewrite ^/eureka/(.*)$ /$1 break;
    }
}
posted @ 2024-07-24 18:10  BigOrang  阅读(19)  评论(0编辑  收藏  举报