This tutorial will be showing you how to run OpenConnect VPN server (ocserv) and Apache/Nginx on the same box with HAProxy. OpenConnect (ocserv) is an open-source implementation of the Cisco AnyConnect VPN protocol.
Prerequisites
To follow this tutorial, it’s assumed that you have already set up an OpenConnect VPN server with Let’s Encrypt TLS server certificate. If not, please follow one of the following tutorials.
- Set Up OpenConnect VPN Server (ocserv) on Ubuntu 20.04 with Let’s Encrypt
- Set Up OpenConnect VPN Server (ocserv) on Ubuntu 16.04/18.04 with Let’s Encrypt
- Set Up OpenConnect VPN Server (ocserv) on Debian 10 Buster with Let’s Encrypt
- Set Up OpenConnect VPN Server (ocserv) on CentOS 8/RHEL 8 with Let’s Encrypt
Make OpenConnect VPN server and web server use port 443 at the same time
By default, OpenConnect VPN server listens on port 443. If you already have Apache/Nginx listening on port 443, then ocserv can’t bind to port 443. You can configure ocserv to listen on another port, but it will require end-users to specify the port in client software, which you should avoid if you care about user experience.
Read full tutorial here: https://www.linuxbabe.com/linux-server/ocserv-vpn-server-apache-nginx-haproxy