In my hostinger vps Ubuntu OS I have to host my ecommerce website (Nginx) along with that I gave to host the admin panel and seller panel website also, but I donno how to host those 2 seller and admin portal as subdomains of the main ecommerce app,
I have tried many ways but couldn’t make it successfully
I tired and host the main app successfully but when I go with the subdomain for example admin.ecommerce.com I still directed to ecommerce.com ( the main Domain)
2
Answers
There should be multiple server sections in the nginx configuration file, and each server section should contain a different server_name and set the root directory to the corresponding file.
Configure DNS records: Set up DNS records for your main domain (ecommerce.com) and the subdomains (admin.ecommerce.com, seller.ecommerce.com). Ensure that these DNS records point to the IP address of your VPS.
Replace /var/www/ecommerce, /var/www/admin, and /var/www/seller with the actual paths to the root directories of your main website and subdomains.
Reload Nginx: After creating the server blocks, reload Nginx to apply the changes:
sudo systemctl reload nginx
Upload website files: Upload your website files to the respective root directories (/var/www/ecommerce, /var/www/admin, /var/www/seller) on your VPS.
Test: Visit your main website (ecommerce.com) and the subdomains (admin.ecommerce.com, seller.ecommerce.com) in a web browser to ensure they are accessible.