ray-note/Bug日志/后端 -- Bug记录.md

9 lines
786 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

## nginx 在https的server中访问http 的链接会失败
当我们有一个申请了 `https` 证书的 `server` 时,如果这个 `server` 中的服务使用到了一个 `http` 的链接,会访问失败,例如: 我在一个 `vue` 的项目中室友了 `http` 的链接时,访问会失败
- 解决办法
- 网上的解决方案好像都是对于nginx做代理的后端资源的解决方案是在server当中添加一个响应头的配置但我的是访问的同一个nginx下不同服务的资源目前这种方案没有尝试过
- 对使用 `http``server` 申请一个 `https` 的证书, 我使用的是 `certbot``nginx` 中指定的server 的域名申请证书
```
sudo certbot --nginx --nginx-server=/nginx_config_path -d the_domain_which_need_https
```