内网环境的项目,要求用https,但是80端口和443端口都被禁用了。
项目开发用的是http,现在用Nginx将http转为https,前端已经能访问,可是调用后台接口就404了,请问各位大佬怎么解决这个问题?
ssl证书是用OpenSSL生成的。
环境是windows。
server {
listen 9528 ssl;
server_name 172.168.16.6;
ssl_certificate C://Users//Desktop//ssl//server.crt;
ssl_certificate_key C://Users//Desktop//ssl//server1.key;
error_page 497 301 =307 https://172.168.16.6:9528$request_uri;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
try_files $uri $uri/ /index.html;
}
location /prod-api/{
proxy_pass http://172.168.16.6:8201/;
proxy_pass_header Server;
proxy_set_header Host $http_host;
#proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Protocol $scheme;
}
下面是错误日志的内容
2020/07/17 10:33:35 [error] 10416#9256: *11 connect() failed (
10061: No connection could be made because the target machine actively refused it) while connecting to upstream,
client: 172.168.16.6, server: 172.168.16.6,
request: "GET /prod-api/login/code HTTP/1.1",
upstream: "http://172.168.16.6:80/login/code",
host: "172.168.16.6:9528",
referrer: "https://172.168.16.6:9528/login?redirect=%2Fdashboard"
2020/07/17 10:33:35 [error] 10416#9256: *11 CreateFile() "C:\Users\Desktop\ssl\nginx-1.16.1/html/50x.html" failed (
2: The system cannot find the file specified),
client: 172.168.16.6,
server: 172.168.16.6,
request: "GET /prod-api/login/code HTTP/1.1",
upstream: "http://172.168.16.6:80/login/code",
host: "172.168.16.6:9528",
referrer: "https://172.168.16.6:9528/login?redirect=%2Fdashboard"