We have installed ERPNext on our local In-house Server successful with multiple sites. Since we have offices in Pune and Delhi as well, we want to now attach this public IP to the different sites we have created.
I am not sure how to go about with this. Please let me know how can we achieve this with single static IP.
Map sub.your-domain.com to your static IP by creating an “A” records to each individual sub-domain in your DNS and this is done at your the Registrar DNS zone records
You need to enable Multi tenant DNS on your server to be able to do what you want. This article/guide should help you set things up
I have already done the multi-tenant based on DNS.
Lets assume I have the sub-domain “http://abc.your-domain.com” and also did the A listing i.e mapping static IP to domain/ sub-domain, how would the sub-domain redirect to the specific ERPNext site “abc” in this case?
You can name your sites as the hostnames that would resolve to it. Thus, all the sites you add to the bench would run on the same port and will be automatically selected based on the hostname.
Are you using port based multi-tenancy or domain based multi-tenancy?
If you have not run bench config dns_multitenant on, then you are using port based multitenancy.
Assuming you want to continue with port based multitenancy (I’d recommend dns based multitenancy anyday, though, you have to set the port for the two sites other than the default site. The first site you set up is automatically designated as the default site.
You set the ports for the other site by running the commands:
bench set-nginx-port site2name 82. Run the command again with a different port for the other site.
Then run:
Re generate nginx config
bench setup nginx
Reload nginx
sudo service nginx reload
You should have a static IP and you should know what that static ip is. If you don’t open a internet browser and google whats my ip.
If it doesn’t just check the configuration on your Firewall (if you have one) or if you have used CentOS or Debian as you base OS, you may need to open up the ports on your server as well.
When you create the sites with matching sub-domain names using bench new-site sub.your-doman.com and then do bench setup nginx bench will map the sub-domains in nginx config file
If you haven’t done so you can use bench setup add-domain --site old-site.name sub.your-domain.com then you do bench setup nginx to apply the new site names and domains
If you are able to access this on the internet, then everything is fine. You just need to set up the domains and wait for it to propagate over the Internet.
If you are not able to access the default site: http://123.45.67.89 on the Internet, now get to a computer that’s on the same network as the Server and open up http://192.168.1.10 (the servers local IP address). If that opens up, but does not open up on the internet, you need to check the ports on your internet connection.
If that doesn’t open up either, just check if you have the server local IP address right. If you are sure you have the server address right, try the following:
Next, try opening up http://localhost on the server. If you have a server OS, you can still install Google Chrome - just Google how. If that doesn’t open up either, its the firewall on the OS related issue or maybe your installation didn’t go through too well.
I tried restarting both the services, but unfortunately it did not work.
Since the server in-house, I tried making a hosts entry in /etc/hosts (on client side, from where I am requesting) and it works but with the site name and just by putting localhost or IP does not work.
I tried this option but it show me the same “Sorry We will be back soon” page with the Local IP/ Static IP and new Sub domain attached now to the site using the commands you suggested.