How to point two different master domains, subdomain (erp.orange and erp.apple) to sites

I have server (say 139.162.52.110)on which I wish to have two sites with different main domain. Ex
erp.apple.com
erp.orange.com

What are all the steps i need to do example

  1. In cpanel of apple.com I have to create “A” record erp.apple.com which points to 139.162.52.110
  2. Inside server i.e. 139.162.52.110 /etc/hosts should have entry 127.0.0.1 erp.apple.com
  3. bench is setup for DNS based multitenancy link
  4. Also custom domain steps are done. link bench setup add-domain --site erp.apple.com erp.apple.com
  5. Also added entry in site_config.json. “host_name”: “http://erp.apple.com

Now in browser when i go for http://erp.apple.com it does reach the server i.e. 139.162.52.110 and nginx page is shown

Please help. thanks:sweat:

3 Likes

nginx.error log

root@localhost:~# tail -f /var/log/nginx/error.log
2017/12/29 14:01:55 [warn] 3555#3555: conflicting server name “erp.orange.com” on 0.0.0.0:80, ignored
2017/12/29 14:02:23 [error] 8183#8183: *9298 upstream prematurely closed connection while reading response header from upstream, client: 14.195.231.233, server: erp.orange.com, request: “GET / HTTP/1.1”, upstream: “http://127.0.0.1:8000/”, host: “139.162.52.115”
2017/12/29 14:03:39 [error] 8183#8183: *9301 upstream prematurely closed connection while reading response header from upstream, client: 14.195.231.233, server: erp.orange.com, request: “GET / HTTP/1.1”, upstream: “http://127.0.0.1:8000/”, host: “139.162.52.115”
2017/12/29 14:16:14 [error] 8183#8183: *9304 upstream prematurely closed connection while reading response header from upstream, client: 14.195.231.233, server: erp.orange.com, request: “GET / HTTP/1.1”, upstream: “http://127.0.0.1:8000/”, host: “139.162.52.115”
2017/12/29 14:40:59 [warn] 9440#9440: conflicting server name “erp.apple.com” on 0.0.0.0:80, ignored
2017/12/29 14:40:59 [notice] 9440#9440: signal process started
2017/12/29 14:40:59 [warn] 3555#3555: conflicting server name “erp.apple.com” on 0.0.0.0:80, ignored
2017/12/29 14:41:21 [error] 9442#9442: *9316 upstream prematurely closed connection while reading response header from upstream, client: 14.195.231.233, server: erp.apple.com, request: “GET / HTTP/1.1”, upstream: “http://127.0.0.1:8000/”, host: “139.162.52.115”
2017/12/29 14:41:33 [error] 9442#9442: *9319 upstream prematurely closed connection while reading response header from upstream, client: 14.195.231.233, server: erp.apple.com, request: “GET / HTTP/1.1”, upstream: “http://127.0.0.1:8000/”, host: “139.162.52.115”
2017/12/29 14:41:34 [error] 9442#9442: *9319 upstream prematurely closed connection while reading response header from upstream, client: 14.195.231.233, server: erp.apple.com, request: “GET / HTTP/1.1”, upstream: “http://127.0.0.1:8000/”, host: “139.162.52.115”

There is a currentsite.txt file in sites directory. Make sure its empty.

1 Like

Wow!! great help @codingCoffee. It does work!!
I have made the change to wiki page link
image

2 Likes

Also note following block of “http to https redirect” needs to be commented in /home/frappe/frappe-bench/config/nginx.conf

# http to https redirect
#	server {
#	    listen 80;
#		server_name
#			erp.apple.com
#			erp.orange.com
#			;
#
#	    return 301 https://$host$request_uri;
#	}
2 Likes

block of “http to https redirect” needs to be commented , is applicable when you opt for https config

1 Like