You have a single incoming IP address and want to run multiple web servers for multiple sites behind this IP address on your local network. The best way to do this is using a reverse proxy server For example:
- Your External IP is: 126.96.36.199 with and internal LAN of 10.1.1.X
- Ports 80 (http) and 443 (https) have been forwarded from your external ip to an internal server at 10.1.1.2 which will handle the reverse proxy and SSL/TLS work using letsencrypt
- You have other application web servers listening on port 80 on your internal LAN at 10.1.1.11 and 10.1.1.12 but these are not accessible from outside your network.
- You have subdomain11.yourdomain.com and subdomain12.yourdomain.com both pointed to 188.8.131.52 and you want visitors to them to see the application servers at 10.1.1.11 and 10.1.1.12 respectively.
- You want to provide secure https access to both subdomains but don’t want to configure this on each of the three servers separately.
This guide is based on using Apache2 on Ubuntu 16.04, some commands may differ slightly between different flavours of Linux but the core configuration for Apache2 should work on any distribution.