Possible to Letsencrypt reverse proxy into OpenVPN?


Recommended Posts

Hi, I recently setup a reserve proxy for some applications (Emby, nextcloud, etc) and have all of these working fine, but I am having trouble figuring out if I can reverse proxy into OpenVPN.

 

I have DuckDNS setup and can access my OpenVPN connection using the duckdns address (let's call it mydomain.duckdns.org:943), but my corporate network blocks access to mydomain.duckdns.org. My domain is setup as subdomain.domainname.com and I have CNAMEs setup like emby.domainname.com which does work from my corporate network. So with that, I'm trying to figure out if I can setup something like openvpn.domainname.com and have it point to OpenVPN correctly. I noticed there isn't a template .conf for letsencrypt to setup OpenVPN.

Link to comment
  • 2 weeks later...

This is definitely possible.  I do something very similar with my custom domain and Cloudflare.  You need to set up stream proxying in your nginx.conf file.

 

stream {

    # Defining upstream servers for proxied traffic
    upstream tcp_backend {
        server 123.456.7.8:9443;
    }
    upstream udp_backend {
        server 123.456.7.8:1194;
    }

    # Defining protocols and ports for data to be proxied.
    server {
        proxy_connect_timeout 300s;
        proxy_timeout 300s;
        listen 9443;
        proxy_pass tcp_backend;
    }
    server {
        proxy_connect_timeout 300s;
        proxy_timeout 300s;
        listen 1193 udp;
        proxy_pass udp_backend;
    }
}

Where 123.456.7.8 is the internal IP address of your OpenVPN server.

Link to comment
  • 1 year later...
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.