Running Multiple Sites on Single IP in Production Mode Without bench start

Hello Community,

I have set up a bench on my server and currently have it accessible via my server IP. I would like to configure multiple sites on the same IP but on different ports, for example:

  • myIP:8000 → Site 1
  • myIP:8001 → Site 2

Is it possible to run multiple sites this way in production mode, without relying on bench start? If so, what would be the recommended approach to achieve this setup?

Thank you in advance for your guidance.

Create multiple bench on server and note one bench have single site so it will be worked and both site have setup production

I tried setting up multiple benches on the same server, with each bench having a single site and running in production mode. However, I ran into several issues during the process. Could you please share the exact set of commands you used for your setup? This will help me cross-check and figure out where the errors are occurring on my end.

It’s called multi-tenancy. You can set it up with ports or domains. You don’t need multiple benches.

1 Like

Thank you for your suggestion. I’m already familiar with the multi-tenancy feature in Frappe. Here’s my current setup:

  • I have a self-hosted Ubuntu VPS.
  • I’ve installed one bench instance named frappe-bench.
  • Under this bench, I’ve created two sites: a.localhost and b.localhost.
  • Production mode has not been configured yet.

What I’m trying to achieve:
I want to run both sites simultaneously—a.localhost accessible at server_ip:8000 and b.localhost at server_ip:8001.

Steps I’ve taken so far:

  • I tried starting each site on a different port using
    bench --site a.localhost serve --port 8000
    and
    bench --site b.localhost serve --port 8001
    in separate terminals.

However, this approach hasn’t worked as expected and I’m encountering errors.
Could you please guide me on the correct way to run multiple sites in development mode on different ports using a single bench installation?

Traceback (most recent call last):
File “env/lib/python3.10/site-packages/redis/connection.py”, line 699, in connect
sock = self.retry.call_with_retry(
File “env/lib/python3.10/site-packages/redis/retry.py”, line 46, in call_with_retry
return do()
File “env/lib/python3.10/site-packages/redis/connection.py”, line 700, in
lambda: self._connect(), lambda error: self.disconnect(error)
File “env/lib/python3.10/site-packages/redis/connection.py”, line 1002, in _connect
raise err
File “env/lib/python3.10/site-packages/redis/connection.py”, line 990, in _connect
sock.connect(socket_address)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “apps/frappe/frappe/www/app.py”, line 30, in get_context
boot = frappe.sessions.get()
File “apps/frappe/frappe/sessions.py”, line 183, in get
bootinfo.has_app_updates = has_app_update_notifications()
File “apps/frappe/frappe/utils/change_log.py”, line 218, in has_app_update_notifications
return bool(frappe.cache.sismember(“changelog-update-user-set”, frappe.session.user))
File “apps/frappe/frappe/utils/redis_wrapper.py”, line 278, in sismember
return super().sismember(self.make_key(name), value)
File “env/lib/python3.10/site-packages/redis/commands/core.py”, line 3359, in sismember
return self.execute_command(“SISMEMBER”, name, value)
File “env/lib/python3.10/site-packages/redis/client.py”, line 1266, in execute_command
conn = self.connection or pool.get_connection(command_name, **options)
File “env/lib/python3.10/site-packages/redis/connection.py”, line 1457, in get_connection
connection.connect()
File “env/lib/python3.10/site-packages/redis/connection.py”, line 705, in connect
raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to 127.0.0.1:13000. Connection refused.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “apps/frappe/frappe/website/serve.py”, line 20, in get_response
return renderer_instance.render()
File “apps/frappe/frappe/website/page_renderers/template_page.py”, line 84, in render
html = self.get_html()
File “apps/frappe/frappe/website/utils.py”, line 534, in cache_html_decorator
html = func(*args, **kwargs)
File “apps/frappe/frappe/website/page_renderers/template_page.py”, line 95, in get_html
self.update_context()
File “apps/frappe/frappe/website/page_renderers/template_page.py”, line 163, in update_context
data = self.run_pymodule_method(“get_context”)
File “apps/frappe/frappe/website/page_renderers/template_page.py”, line 223, in run_pymodule_method
return method(self.context)
File “apps/frappe/frappe/www/app.py”, line 32, in get_context
raise frappe.SessionBootFailed from e
frappe.exceptions.SessionBootFailed

I’m trying to run multiple sites on the same server without a domain name (only using the server IP).

Here’s what I tried:

  • In the first terminal, I ran: bench start
  • In the second terminal, I ran: bench --site a.localhost serve --port 8001
  • In the third terminal, I ran: bench --site b.localhost serve --port 8002

With this setup, both sites open in the browser simultaneously, but the issue is that I keep getting logged out suddenly.

Since I don’t have a domain name yet, I want to access these sites only through the server IP.

Could anyone please guide me on how to properly configure this so sessions don’t conflict? Any hints or suggestions would be much appreciated.

Thanks in advance!

Ah, my bad! I overlooked the detail that you want this in development.

Try this sequence:

Terminal 1

bench use a.localhost
bench serve --port 8001

Terminal 2

bench use b.localhost
bench serve --port 8002

I tried running both sites using separate ports with the following commands as you suggested:

bench use a.localhost
bench serve --port 8001

bench use b.localhost
bench serve --port 8002


The sites do start individually on different ports, but the issue I’m facing is that when I log into one site (e.g., `IP:8000`), I automatically get logged out from the other one (e.g., `IP:8001`).

Is there a way to run both sites at the same time without the sessions conflicting?

I can think of two possible solutions:

A) Use unique hostnames. Map two hostnames to loopback to your localhost on the etc/hosts file, Linux or Windows (if on WSL). You’d add something like:

127.0.0.1 a.localhost
127.0.0.1 b.localhost

And access them with the hostname not IP:Port

B) Just use two different browsers or find an extension on the browser to separate logins/cookies.

Btw, your original post mentioned

production mode

that’s why I posted my original answer :wink:

Thank you very much for your help and for taking the time to suggest possible solutions.

Just to clarify, I have already enabled multi-tenancy and my requirement was to run the sites in production using an IP address, since I haven’t been assigned a domain name yet. Initially, I encountered several issues including Redis, Nginx, and Socket.IO errors. After troubleshooting, I was able to resolve those issues and currently have it running successfully by using the following command:

bench --site a.localhost serve --port 8000

This works for now in my testing environment. However, I do plan to use proper domain names and host the sites accordingly in the future.

Once again, I really appreciate your guidance and support.