How to setup multiple Sites on single Bench instance?

I have followed most of the tutorials for setting up multiple sites on single instance of Bench. But have not been able to get success.

What I want is to create a single Production instance of Bench and then add new Sites. Some sites will only contain custom Frappe Apps and some will have ERPNext, HRMS & India Compliance installed in them.

How to do this locally as well as on a cloud VPS?

Please share step by step guide for this.

You can create new site in same bench,

bench new-site {site_name}

And install app for particular site using,

bench --{site_name} install-app {app_name}

2 Likes

Hi @yogeshvachhani:

Let’s say you will different dns names (other option is the same url with different ports):

bench config dns_multitenant on
bench new-site yoursite.localhost
bench setup nginx
sudo service nginx reload

Hope this helps.

2 Likes

I have performed all the steps you have suggested but I am not able to access the second site using the url: erp.mydomain.com or erp.mydomain.com/site2.

What else do I have to setup?

Hi @yogeshvachhani:

Each site has own url:

yoursite1.mydomain.com
yoursite2.mydomain.com

After bench setup nginx your bench will be “listening” but … have you pointed your DNS to the public ip of your server? It should be done on your domain control panel.

Hope this helps.

1 Like

Thanks for the clarification.

I am making the mistake of trying to access the sites using same url.

I will have to use different url.

Once again Big Thanks.

But in case when we are setting up Frappe & ERPNext for production locally on PC in our local network what should we do so that all users can access the sites in single instance.

I tried the steps suggested locally but I cannot access it from another PC in the local network.

Hi @yogeshvachhani:

I assume that you have not a DNS server in your network, so add the host in your hosts file, on each PC on your network. This way:

(let’s say that your server PC LAN ip is 192.168.0.25)

`192.168.0.25    erp.mydomain.com`   

On Windows environment hosts file is located under

C:\Windows\System32\drivers\etc 

Use notepad with administrator privileges to edit.

Check this:

Hope this helps.

2 Likes

Thanks you for clear instructions.

I will test them out next week.

One last question.

Do I have to setup LetsCrypt for every site on VPS?

Or is there any way to setup wildcard SSL using LetsCrypt?

Hi @yogeshvachhani:

I’ve used letscrypt for each site, but check this:

And this:

Hope this helps.

1 Like