Post Multitenant Setup cannot see ERPNext instances?

Hi guys.

Succesfully managed to install ERPNext via the Easy Install script onto Ubuntu 14.04 32 hosted by Digitia ocean.

Application was running as expected and all great. Configured the instance of ERPNext using the setup wizard successfully.

I then followed the followed the Multitenant Setup steps for DNS based multitenancy created a new site as below:

bench config dns_multitenant on
To make a new site under DNS based multitenancy, perform the following steps.

Create a new site

bench new-site subdomain.domain.com

Re generate nginx config

bench setup nginx

Reload nginx

sudo service nginx reload

Unfortunately I unable to access any of my 2 sites?

would anybody be able to advise if theres some additional steps needed that I may have missed?

where I could previously view the one site (prior to switching on Multitennancy) via the ip address this is now throwing up and error message?

Many Thanks in advance

A DNS Multitenant setup means that you’re accessing your site via a sub-domain / domain, you need to point your domain and subdomain to that IP and access it from there.

Also, make sure to remove the currentsite.txt from the sites folder.

@PaulTheTrouble Hi if you have changed the port at the time of configuration in nginx.conf by default its 8000 and if you may have changed at the start eg: 8021 and if you go with the command bench setup ngins it will override the port that you have given so please check your nginx.conf file and if your using default port please give some more details to track down

Thanks khushal

Hi vjFaLK I really appreciate your response.

Ok so deleted the currentsite.txt file but still no luck…

Just so I am clear, in Digital Ocean the subdomin.domain is directed to the IP address to which I am running ERP Next on.

I have also created the new site with the naming convention of subdomain.domain and i can see this in the site folder.

I have seen previous posts suggesting that host_name needs to be entered in the site_config.json file but I was under the impression this is no longer needed.

Any other changes I may need to make to make this work?

Thanks

Paul

Hi @khushal_t

Thanks for the response. I haven’t knowingly made changes to any ports and I am under the impression that the dns multi tennancy would run under the same port.

Problem still remains…?

Any other thoughts?

for info below is the content of the nginx.conf file:

root@ubuntu-2gb-lon1-01:/etc# cd nginx
root@ubuntu-2gb-lon1-01:/etc/nginx# ls
conf.d koi-utf mime.types naxsi.rules nginx.conf proxy_params sites-available uwsgi_params
fastcgi_params koi-win naxsi_core.rules naxsi-ui.conf.1.4.1 nginx.conf.old scgi_params sites-enabled win-utf
root@ubuntu-2gb-lon1-01:/etc/nginx# less nginx.conf

For more information on configuration, see:

* Official English Documentation: http://nginx.org/en/docs/

* Official Russian Documentation: http://nginx.org/ru/docs/

user www-data;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

events {
worker_connections 2048;
}

http {
log_format main '$remote_addr - $remote_user [$time_local] “$request” ’
'$status $body_bytes_sent “$http_referer” ’
‘"$http_user_agent" “$http_x_forwarded_for”’;

access_log  /var/log/nginx/access.log  main;

sendfile            on;
tcp_nopush          on;
tcp_nodelay         on;
keepalive_timeout   65;
types_hash_max_size 2048;

include             /etc/nginx/mime.types;
default_type        application/octet-stream;

# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;

}
nginx.conf (END)

from frapp-bench nginx.conf, still a problem?

upstream frappe-bench-frappe {
server 127.0.0.1:80 fail_timeout=0;
}

upstream frappe-bench-socketio-server {
server 127.0.0.1:9000 fail_timeout=0;
}

setup maps

map $host $site_name_njoqswl {
beecreative.hayora360.com beecreative.hayora360.com;
default $host;

}

server blocks

server {
listen 80;
server_name
hayora360.com
site1.local
beecreative.hayora360.com
beecreative.hayora360.com
;

    root /home/frappe/frappe-bench/sites;

    

    

    location /assets {
            try_files $uri =404;
    }

    location ~ ^/protected/(.*) {
            internal;
            try_files /$site_name_njoqswl/$1 =404;
    }

    location /socket.io {
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header X-Frappe-Site-Name $site_name_njoqswl;
            proxy_set_header Origin $scheme://$http_host;
            proxy_set_header Host $host;

            proxy_pass http://frappe-bench-socketio-server;

@PaulTheTrouble Hi i guess your nginx.conf file doesn’t seem to be correct, please check below nginx.conf file with yours except the server names in server block.

upstream frappe-bench-frappe {
server 127.0.0.1:8000 fail_timeout=0;
}

upstream frappe-bench-socketio-server {
server 127.0.0.1:9000 fail_timeout=0;
}

setup maps

server blocks

server {
listen 80;
server_name
yuiop.com
jaihnd.com
;

root /home/indictrans/Magento/Workspace/frappe-bench/sites;

location /assets {
try_files $uri =404;
}

location ~ ^/protected/(.*) {
internal;
try_files /$host/$1 =404;
}

location /socket.io {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “upgrade”;
proxy_set_header X-Frappe-Site-Name $host;
proxy_set_header Origin $scheme://$http_host;
proxy_set_header Host $host;

  proxy_pass http://frappe-bench-socketio-server;

}

location / {
try_files /$host/public/$uri @webserver;
}

location @webserver {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Frappe-Site-Name $host;
proxy_set_header Host $host;
proxy_set_header X-Use-X-Accel-Redirect True;
proxy_read_timeout 120;
proxy_redirect off;

  proxy_pass  http://frappe-bench-frappe;

}

error pages

error_page 502 /502.html;
location /502.html {
root /home/indictrans/Magento/Workspace/bench-repo/bench/config/templates;
internal;
}

optimizations

sendfile on;
keepalive_timeout 15;
client_max_body_size 50m;
client_body_buffer_size 16K;
client_header_buffer_size 1k;

enable gzip compresion

based on https://mattstauffer.co/blog/enabling-gzip-on-nginx-servers-including-laravel-forge

gzip on;
gzip_http_version 1.1;
gzip_comp_level 5;
gzip_min_length 256;
gzip_proxied any;
gzip_vary on;
gzip_types
application/atom+xml
application/javascript
application/json
application/rss+xml
application/vnd.ms-fontobject
application/x-font-ttf
application/font-woff
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
image/svg+xml
image/x-icon
text/css
text/plain
text/x-component
;
# text/html is always compressed by HttpGzipModule
}

@PaulTheTrouble Please make the port 8000 in nginx.conf. If still it doesnt worked out try to name the site name same as your domain name.For ex, if your domain name is hayora360.com then try to name your site name same as domain name i.e hayora360.com

Hi @khushal_t and @Onkar_Mirajkar

I have updated nginx.conf with port 8000 but still no luck. I can also confirm that sites are named as per domain name and subdomain.

I notice in the nginx that I do have some slight differences in the example provided by @khushal_t

Example

Above:
try_files /$host/$1 =404;
proxy_set_header X-Frappe-Site-Name $host;

In my file I have:

try_files /$site_name_njoqswl/$1 =404;
proxy_set_header X-Frappe-Site-Name $site_name_njoqswl;

Is this something I also need to change? I have no idea why my file has this site_name njoqswl referenced?

BELOW is my current nginx.conf file:

Thanks again for your help…

Paul

upstream frappe-bench-frappe {
server 127.0.0.1:8000 fail_timeout=0;
}

upstream frappe-bench-socketio-server {
server 127.0.0.1:9000 fail_timeout=0;
}

setup maps

map $host $site_name_njoqswl {
beecreative.hayora360.com beecreative.hayora360.com;
default $host;

}

server blocks

server {
listen 80;
server_name
hayora360.com
site1.local
beecreative.hayora360.com
beecreative.hayora360.com
;

    root /home/frappe/frappe-bench/sites;

    

    

    location /assets {
            try_files $uri =404;
    }

    location ~ ^/protected/(.*) {
            internal;
            try_files /$site_name_njoqswl/$1 =404;
    }

    location /socket.io {
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header X-Frappe-Site-Name $site_name_njoqswl;
            proxy_set_header Origin $scheme://$http_host;
            proxy_set_header Host $host;

            proxy_pass http://frappe-bench-socketio-server;

:

Guys… @khushal_t @Onkar_Mirajkar

Quick update!

ran sudo service nginx restart

and its now working! Yippeee thanks very much for your help… much appreciated.

Paul