Nginx 代理通过服务器在 4443 端口运行,使用 lets encrypt ssl

Nginx 代理通过服务器在 4443 端口运行,使用 lets encrypt ssl

我正在尝试4443使用 nginx 代理在端口上运行的 Java 应用程序。我的 nginx 服务器块如下所示:

map $http_upgrade $connection_upgrade {
     default upgrade;
     ''      close;
}

 upstream ovserver {
    server example.com:4443;
 }

 server {
    server_name ov.example.com www.ov.example.com;


    location / {
            proxy_pass https://ovserver;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;
            proxy_http_version 1.1;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_intercept_errors on;
            proxy_redirect off;
            proxy_cache_bypass $http_upgrade;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-NginX-Proxy true;
            proxy_ssl_session_reuse off;
    }

        listen [::]:443 ssl;
        listen 443 ssl;
        ssl_certificate /etc/letsencrypt/live/ov.example.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/ov.example.com/privkey.pem;
        include /etc/letsencrypt/options-ssl-nginx.conf;
        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

}

server {
    if ($host = ov.example.com) {
        return 301 https://$host$request_uri;
    } 
        listen 80;
        listen [::]:80;
        server_name ov.example.com www.ov.example.com;
        return 404;
}

我需要将端口 4443 上的 Java 应用程序生成的所有请求定向到给定的主机。例如:

https://example.com:4443/something/here  => https://ov.example.com/something/here
wss://example.com:443/something/here     => wss://ov.example.com/something/here

但就我目前的配置而言,它仍然无法工作。任何建议都值得赞赏。

更新 1

curl 请求示例:

curl --user name:password https://example.com:4443/something/api/here
curl: (60) SSL certificate problem: self signed certificate

curl --user name:password https://ov.example.com/something/api/here
{"numberOfElements":0,"content":[]} # expected response

更新2

curl --user name:password https://example.com:4443/something/api/here --key /etc/letsencrypt/live/ov.example.com/privkey.pem --cert /etc/letsencrypt/live/ov.example.com/cert.pem

 #response
 SSL certificate problem: self signed certificate

相关内容