First of all check whether nginx is present on the server if not then run the commands to install the nginx: ``` sudo apt update sudo apt install nginx -y ``` Now enable and start the nginx service: ``` sudo systemctl enable nginx.service sudo systemctl start nginx.service ``` So now nginx has installed on the server go to this path /etc/nginx/sites-available and create a file using nano with any name for example rpc and add the below content to point the port 26657 to 80. ``` server { server_name rpc.test.witval.com; #rpc.test.witval.com is domain name location / { proxy_pass http://backend_rpc; proxy_set_header Host $host; # Add this line to preserve the original host header } # Add a separate location block to handle URL rewrite without port location ~ ^/(.*)$ { proxy_pass http://backend_rpc/$1; proxy_set_header Host $host; # Add this line to preserve the original host header } } upstream backend_rpc { server rpc.test.witval.com:26657; } ``` Save the file and create a symbolic link and restart nginx service: ``` sudo ln -s /etc/nginx/sites-available/rpc /etc/nginx/sites-enabled sudo systemctl restart nginx.service ``` After this we have to setup TLS on the domain for that run the following commands: ``` sudo apt install certbot python3-certbot-nginx sudo certbot --nginx -d rpc.test.witval.com #-d is for doamin ``` After TLS setuped just restart the nginx service: ``` sudo systemctl restart nginx.service ``` Now we have to do the same for pointing the second domain. So again go to this path /etc/nginx/sites-available and create a file using nano with any name for example api and add the below content to point the port 1317 to 80. ``` server { server_name api.test.witval.com; location / { proxy_pass http://localhost:1317/; } } ``` Save the file and create a symbolic link and restart nginx service: ``` sudo ln -s /etc/nginx/sites-available/api /etc/nginx/sites-enabled sudo systemctl restart nginx.service ``` Setup the TLS on the second domain so for that run the below command: ``` sudo certbot --nginx -d api.test.witval.com ``` So after above all the steps just restart the nginx service and we are done!