2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-12-23 18:48:58 +00:00
frappe_docker/docs/port-based-multi-tenancy.md
2022-05-02 14:01:36 +05:30

1.2 KiB

WARNING: Do not use this in production if the site is going to be served over plain http.

Step 1

Remove the traefik service from docker-compose.yml

Step 2

Create nginx config file /opt/nginx/conf/serve-8001.conf:

server {
	listen 8001;
	server_name $http_host;

	location / {

 		rewrite ^(.+)/$ $1 permanent;
  		rewrite ^(.+)/index\.html$ $1 permanent;
  		rewrite ^(.+)\.html$ $1 permanent;

		proxy_set_header X-Frappe-Site-Name mysite.localhost;
		proxy_set_header Host mysite.localhost;
		proxy_pass  http://frontend;
	}
}

Notes:

  • Replace the port with any port of choice e.g. listen 4200;
  • Change mysite.localhost to site name
  • Repeat the server blocks for multiple ports and site names to get the effect of port based multi tenancy
  • For old images use proxy_pass http://erpnext-nginx instead of proxy_pass http://frontend

Step 3

Run the docker container

docker run --network=<project-name>_default \
  -p 8001:8001 \
  --volume=/opt/nginx/conf/serve-8001.conf:/etc/nginx/conf.d/default.conf -d nginx

Note: Change the volumes, network and ports as needed

With the above example configured site will be accessible on http://localhost:8001