[Tutorial] How To install Port based multitenant sites for Production

ERPNext V12, Frappe 12 or later
Applies to any OS.

Enable Port based multitenant sites on a single bench and single server, production instance

I have already installed my first site and it’s up and running (frappe.local) as production instance, locally installed on my laptop.

I have installed second site called meeting.dev on the same bench as my previous site.

0- Create new site as frappe (non root) under frappe-bench folder:

bench new-site meeting.dev

1- run command as frappe (not root), cd to frappe-bench:

note : by default first site will get port# 80

frappe@LAPTOP-5F23F7J8:~/frappe-bench$ bench set-nginx-port meeting.dev 81
Port configuration list:

Site frappe.local assigned port: 80

Site meeting.dev assigned port: 81
nginx.conf already exists and this will overwrite it. Do you want to continue? [y/N]: y

2- step#2 run below command :
frappe@LAPTOP-5F23F7J8:~/frappe-bench$ sudo supervisorctl restart all
frappe-bench-workers:frappe-bench-frappe-schedule: stopped
frappe-bench-web:frappe-bench-node-socketio: stopped
frappe-bench-redis:frappe-bench-redis-queue: stopped
frappe-bench-redis:frappe-bench-redis-cache: stopped
frappe-bench-redis:frappe-bench-redis-socketio: stopped
frappe-bench-workers:frappe-bench-frappe-default-worker-0: stopped
frappe-bench-workers:frappe-bench-frappe-long-worker-0: stopped
frappe-bench-workers:frappe-bench-frappe-short-worker-0: stopped
frappe-bench-web:frappe-bench-frappe-web: stopped
frappe-bench-workers:frappe-bench-frappe-schedule: started
frappe-bench-workers:frappe-bench-frappe-default-worker-0: started
frappe-bench-workers:frappe-bench-frappe-long-worker-0: started
frappe-bench-workers:frappe-bench-frappe-short-worker-0: started
frappe-bench-web:frappe-bench-frappe-web: started
frappe-bench-web:frappe-bench-node-socketio: started
frappe-bench-redis:frappe-bench-redis-queue: started
frappe-bench-redis:frappe-bench-redis-cache: started
frappe-bench-redis:frappe-bench-redis-socketio: started

3- step#3 run below command :
frappe@LAPTOP-5F23F7J8:~/frappe-bench$ sudo service nginx restart

  • Restarting nginx nginx [ OK ]

4- browse for 1st site URL: http://localhost and 2nd site URL: http://localhost:81

Port based multitenancy

Port based multitenant, multi sites