微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

在 NGINX 中遇到“GET /webjars/springfox-swagger-ui/favicon-16x16.png?v=2.9.2 HTTP/1.1”404

如何解决在 NGINX 中遇到“GET /webjars/springfox-swagger-ui/favicon-16x16.png?v=2.9.2 HTTP/1.1”404

请帮助我在 Nginx 中访问我的 springboot swagger-ui.html(但我可以访问 /v2/api-docs)时遇到问题,我从 access.log ("GET /webjars/springfox-swagger -ui/favicon-16x16.png?v=2.9.2 HTTP/1.1" 404 in Nginx) 从浏览器访问时。但是 error.log 没有显示任何错误。下面是我的 .conf 文件。我已经检查了 stackoverflow 上的所有现有问题和解决方案,但没有解决我的问题。 springboot 应用程序在 centos8 上以 jar 文件的形式运行。

server {
    if ($host = www.domain.com) {
    return 301 https://$host$request_uri;
} # managed by Certbot


if ($host = domain.com) {
    return 301 https://$host$request_uri;
} # managed by Certbot


    listen       80;
    listen       [::]:80;
    index index.html index.htm index.Nginx-debian.html;

    server_name  www.domain.com developer.domain.com domain.com;
    return 404; # managed by Certbot
}

server {
server_name  www.domain.com developer.domain.com domain.com;
    
#access_log  domainlog/host.access.log  main;

location / {
        index index.html index.htm index.Nginx-debian.html;


        proxy_pass http://ipaddress:8008/v2/api-docs
        proxy_redirect     off;

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

location /rec-service {
        proxy_pass http://ipaddress:8008/swagger-ui.html;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Port $server_port;
}


location /proc-service {
        proxy_pass http://ipaddress:8009/swagger-ui.html;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Port $server_port;
}


location /transX-service {
        proxy_pass http://ipaddress:8010/swagger-ui.html;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Port $server_port;
}


location /client-service {
        proxy_pass http://ipaddress:8011/swagger-ui.html;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Port $server_port;
}


location /xTransfer-Service {
        proxy_pass http://ipaddress:8012/swagger-ui.html;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Port $server_port;
}

    error_page  404              /404.html;

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   html;
    }

listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-Nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # manage`enter code here`d by Certbot
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。