I have a website with domain example.com
in a server with IP x.x.x.x. It runs with Nginx and Let's Encrypt very well, which is located in /var/www/app1. The domain is obtained and managed via a providerXYZ.
Last time I can deploy a web application which I installed in the same server in /var/www/app2 as a subdomain of my example.com, so that I can access it with myapp1.example.com
. I can configure the A record of the DNF in my providerXYZ to add a subdomain and write a new server block in Nginx with server name myapp1.example.com
.
Now, I installed my nextcloud in another server with ip y.y.y.y, which is located in /var/www/nextcloud. How can I configure my DNS and Nginx to access my nextcloud via mycloud.example.com
?
The problem what I'm facing now is that I cannot start the nextcloud in the server IP y.y.y.y, since it needs a server name, root and SSL cert path in the Nginx configuration file. Instead, I think I have to write server block in my Nginx configuration file of the server x.x.x.x. But I don't know how to write a server block which root in another server y.y.y.y.
If such a way is not possible, I can buy a new domain to assign it for my nexcloud in the new server y.y.y.y. I just don't want to have many domain names.
Thanks in advanced.