Is this possible?

I'm trying to run an nginx server as well as another service on port 443.

Put it simply, is there a way I can do something like this?

ext.ip:443 -> int.ip:443

sbd.ext.ip:443 -> int.ip:1080

I am NOT trying to run multiple websites, in fact, I am already doing this. The second service is unrelated to website hosting. Also, if it's relevant, I'm running Ubuntu Server LTS 22.04

Edit: I am also willing to compromise by sending it to another internal IP, like this:

ext.ip:443 -> one.int.ip:443

sbd.ext.ip:443 -> two.int.ip:443

Posted Apr 6, 2023, 12:24 PM UTC · edited

23
Gagootron•

If your other service is using TLS, then yes. In that case you can use a reverse proxy using the TLS hostname for the routing.

1
ImpulsiveLeaksOP•

from a quick Google search, the application I want to use (shadowsocks socks5 proxy) does use TLS, how would I go about implementing this?

1
Gagootron•

Something like this stack overflow answer should work for you. Then you only need nginx. You need to set the https server of nginx to a port different from 443 (like 8443) and then set the proxy to direct

ext.ip -> localhost:8443

sbd.ext.ip -> localhost:1080

As long as shadowsocks uses the SNI extension of TLS this should work.

Note: For this to work you need to have the following things:

  • A domain you control
  • A valid SSL certificate ( let's encrypt is a good free option, if you google 'nginx let's encrypt' you should find some tutorials )

Otherwise you will not be able to do this.

1