decidim-install
decidim-install copied to clipboard
How to configure subdomain for multitenant installation
Hello,
thanks, for your guide, it's great. I've just one doubt: how should I configure my installation to support more than one organisation? Now my domain is decidim.test and, if I add an organisation with host decidim.test and open that page, I've that organisation login form. When I add a second organisation I should use a different host (org2.decidim.test) but obviously it doesn't work and at that page I just see an nginx error. Which is the correct way to configure multi-tenancy? Which are the files I should edit?
Thanks
when you say that you are using decidim.test, you mean literally? .test domains are for... testing.
If that's the case you need to add in your /etc/hosts
system all the domains you want to test to point to localhost (or 127.0.0.1).
As a general case, you need to point any domain or subdomain used for a tenant to the server you are using, then go to anyworkingdomain.tld**/system**, log in there and configure the other tenant, you need to add the full subdomain there as the name of the tenant host.
Yes, domain is .test because is a local domain I use to learn how decidim works :) Thanks for your reply: i've added org2.decidim.test and org1.decidim.test to /etc/hosts
but I can't reach the tenants' login pages even though i can ping those domains. So, I've tried to edit /etc/nginx/decidim.conf
(now the line server_name
is *.decidim.test
) and now i can open both tenants; unfortunately, i can't see anymore the /system logon page, just the nginx message: "If you see this page, the nginx web server is successfully installed and working. Further configuration is required". Probably I'm missing something in nginx configuration or DNS, I should check.
Clearly nginx is not reaching passenger (or puma), try to post here the nginx configuration
After some tests now i've this environment: one domain decidim.test with two organisations (decidim.test and org2.decidim.test). I can login in /system page and in decidim.test tenant; when i try to login in org.decidi.test there's an Nginx error: "If you see this page, the nginx web server is successfully installed and working. Further configuration is required"
This is my mod-http-passenger.conf
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /home/decidim/.rbenv/shims/ruby;
Here nginx.conf
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
And here my sites-enabled/decidim.conf
server {
listen 80;
listen [::]:80 ipv6only=on;
server_name decidim.test;
client_max_body_size 32M;
passenger_enabled on;
passenger_ruby /home/decidim/.rbenv/shims/ruby;
rails_env production;
root /home/decidim/decidim-app/public;
}
I'd say you have the problem in your decidim.conf file, try to use "_" and "default_server" in it:
server {
listen 80 default_server;
listen [::]:80 ipv6only=on;
server_name decidim.test _;
client_max_body_size 32M;
passenger_enabled on;
passenger_ruby /home/decidim/.rbenv/shims/ruby;
rails_env production;
root /home/decidim/decidim-app/public;
}
I've tried to edit decidim.conf file but nginx can't be restarted with the following error
2020/06/11 17:47:59 [emerg] 2259#2259: a duplicate default server for 0.0.0.0:80 in /etc/nginx/sites-enabled/default:22
2020/06/11 17:47:15 [emerg] 2226#2226: a duplicate default server for 0.0.0.0:80 in /etc/nginx/sites-enabled/default:22
The problem is with line listen 80 default_server;
the remove the other configuration file, you cannot have to defintions of default_server as the message stands