I have set up a reverse proxy on my public server using Nginx to access the remote port of my private server. However, as I noticed, the communication between my public server and private server is not encrypted. To solve this issue, I enabled HTTPS proxy in my frpc configuration and exposed a virtual host HTTPS port. I then redirected a specific port to the virtual host HTTPS port. Although the connection is established, I am unable to route to the correct destination.

If I directly access the subdomain: remote port, I am able to access it normally. However, if I add an extra layer of Nginx reverse proxy, I am unable to access it. I then discovered that Frp has a built-in encryption for frpc and frps. I would like to know if this is a secure configuration:

*public server --> Nginx (HTTPS) --> Remote port*
*public server --> Nginx (HTTPS) --> Virtual host HTTPS port --> Remote port*

I would appreciate any suggestions or advice on how to improve this configuration.