Public use on open networks is sometimes only open to some ports with all ports disabled. In such cases, we prefer 443 port on our VPN servers. It is not possible to provide both web and VPN services from a server using the same port under normal conditions. A port at an IP address can only use one program.
How will you use two services in a one port?
We will use a firewall for this. The firewall will route requests to the server looking at the ip address of incoming requests. We need to know where at least one traffic is coming from to get directions. So we need to use a free proxy web service. With the proxy service, we will know the IP addresses that the web service wants to access. Cloudflare is a free web proxy service. The IP addresses of Cloudlfare servers are up to date https://www.cloudflare.com/ips-v4.
I chose to use 443 for web service and 60692 for vpn service on my system.
#İf you need latest Cloudflare ipv4 block you can try this command
curl https://www.cloudflare.com/ips-v4 -s | tr '\n' ',' | sed 's/.$//'
#Cloudflare redirect web trafic to web server
iptables -t nat -A PREROUTING -s \
-p tcp --dport 443 -j DNAT --to-destination :443
#VPN trafic redirect to your vpn service port
iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination :60692
We redirect traffic from Cloudflare to web server,from outside Cloudflare was directed to VPN server.