Set up erpnext on subdomain only

So I have an Ubuntu 16.04 VPS. I would like to set up my ERPNext instance on a subdomain rather than the main domain: erp.domain.com (domain.com should preferably host a WordPress site).

Right now, however, ERPNext is accessible on both the main domain and all the subdomains that point to the server IP. I should mention i used the Easy Install method.

I have changed the hostname in nginx,conf to erp.domain.com and renamed the site1.local folder to erp.domain.com but domain.com still serves up the site.

I have also tried to change the hostname via command line:
bench setup add-domain erp.domain.com
but I get errors

So how do I free up domain.com so I can install WordPress as the main site?
Is it something to do with the DNS records?

I know there may be similar questions to these on the forum, but I’ve gone through quite a number and couldn’t find a direct solution. I’m new to ERPNext and will appreciate your help!

which subdomain and domain you are using?

You need to add separate A record for subdomain and domain in your domain hosting provider.

i can create sub domain record and but i can link it with my bench !

Hy i want to install on the subdomain too. Is your problem fixed? Please let me know how to setup erpnext on subdomain.