问题描述
请帮助我在 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 (将#修改为@)