Nginx + spring不为suddomain提供静态文件

时间:2017-06-21 14:00:37

标签: java spring spring-mvc nginx

我将spring应用程序迁移到另一台使用nginx的服务器。 该应用程序需要作为子域提供,但只显示* .jsp和* .html文件。

静态文件未成立,因为它已被请求,就好像应用程序是在域之后部署的那样(domain.com.br:8765/subdomain /)

这是我的nginx配置:

server {
    listen       80;
    server_name  subdomain.domain.com.br;

    location / {
            proxy_pass http://domain.com.br:8765/subdomain/;
    }

    location ~* \.(jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|mp3|flv|mpeg|avi)$ {
            proxy_pass              $scheme://domain.com.br:8765/$request_uri;
            proxy_redirect          off;
            proxy_set_header        X-Real-IP $remote_addr;
            proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header        Host $http_host;
            expires 30d;
    }
}

春天日志

No mapping found for HTTP request with URI [/subdomain/subdomain/resources/css/base.css]
No mapping found for HTTP request with URI [/subdomain/subdomain/resources/js/jquery-1.7.2.min.js]
No mapping found for HTTP request with URI [/subdomain/subdomain/resources/js/jquery-ui-1.8.16.js]

0 个答案:

没有答案