# How to setup multiple domains on one IP using apache2 First of all check whether apache2 is present on the server if not then run the commands to install the apache2: sudo apt update sudo apt install apache2 Now enable and start the apache2 service: sudo systemctl enable apache2.service sudo systemctl start apache2.service So now apache2 has installed on the server go to this path /etc/apache2/sites-available and create a file using nano with any name for example rpc.conf and add the below content to point the port 26657 to 80. <VirtualHost *:80> ServerName rpc.test.witval.com # DocumentRoot /path/to/your/webroot # Use ProxyPassMatch to forward requests to the correct port without specifying it in the URL ProxyPassMatch / http://rpc.test.witval.com:26657 ProxyPassReverse / http://rpc.test.witval.com:26657/ #Remove port from URLs ProxyPreserveHost On RewriteEngine On RewriteCond %{HTTP_HOST} :26657$ RewriteRule ^/(.*) http://rpc.test.witval.com/$1 [L,R=301] </VirtualHost> Save the file and create a symbolic link and restart apache2 service run the below commands: sudo a2ensite rpc.conf ## run this cmd from the site-available directory sudo a2enmod ssl sudo a2enmod proxy_http sudo a2enmod proxy sudo systemctl restart apache2.service After this we have to setup TLS on the domain for that run the following commands: sudo apt install apache2 certbot python3-certbot-apache sudo certbot --apache -d rpc.test.witval.com #-d is for doamin After TLS setuped just restart the apache2 service: sudo systemctl restart apache2.service Now we have to do the same for pointing the second domain. So again go to this path /etc/apache2/sites-available and create a file using nano with any name for example api.conf and add the below content to point the port 1317 to 80. <VirtualHost *:80> ServerName api.test.witval.com ProxyPass / http://api.test.witval.com:1317/ ProxyPassReverse / http://api.test.witval.com:1317/ ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined RewriteEngine on RewriteCond %{SERVER_NAME} =api.test.witval.com RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] </VirtualHost> Save the file and create a symbolic link and restart apache2 service: sudo a2ensite api.conf ## run this cmd from the site-available directory sudo systemctl restart apache2.service Setup the TLS on the second domain so for that run the below command: sudo certbot --apache -d api.test.witval.com So after above all the steps just restart the apache2 service and we are done!