Multiple domain with Dedicated IPs, same DocumentRoot

Hello. I'm in order to run a VPS with an Opencart multi-store ecommerce. Each store will have his own geolocated domain / IP, but i need to point for same APP / DocumentRoot.

How can i to do it? I tried creating sub-servers, but can't point to same DocumentRoot.

Thank you.

Status: 
Active

Comments

Howdy -- thanks for contacting us!

Just to verify --

Are you saying that you want to have multiple domains each with their own IP address, but each domain should point at one DocumentRoot?

That is, you'd have a DocumentRoot such as /home/main_app/public_html, and every domain will be pointing at that same directory?

Hi andreychek and thank you for your help.

Yes, you right.

Just to clarify: I have Opencart at mydomain.com, with IP 123.123.123.123 and points to /home/mydomain/public_html. Now i need multiple domains points also to same folder /home/mydomain/public_html bu with different IPs

Example:

  • mydomain.com - 123.123.123.123 - /home/mydomain/public_html
  • mydomain.es - 123.123.123.124 - /home/mydomain/public_html
  • mydomain.fr - 123.123.123.125 - /home/mydomain/public_html
  • mydomain.pt - 123.123.123.126 - /home/mydomain/public_html

Thank you in advance.

Hmm, that's unfortunately not really something that the Virtualmin UI supports.

You can certainly add aliases to a given Virtual Server or Sub-Server, but in that case, the alias would have the same IP as the parent.

Talking to Joe about that, we think the only real way to accomplish what you're asking -- aliases with unique IP addresses -- would be to setup one domain within Virtualmin, to copy it's Apache VirtualHost definition, and then to make copies of it and manually modify them so that they're using the additional domains and IP addresses you wish to setup.

Sorry, I know that's a bit of a hassle, but that's unfortunately not a common setup that folks need.

Alternately, you could use regular domain aliases in Virtualmin, but change the IP addresses in DNS for each of those alias domains to point to different virtual IPs on your system.

In my humble opinion this issue in not related to Virtualmin configuration. It should be solved inside OpenCart configuration using a module free or not. Two years ago I had a similarly request from a client related to a Magento store and I solved it buying an extension. That extension allowed me to configure one domain or multiple domains. The extension was dealing with client IP's. If the IP was from Germany the extension passed German store version, if UK the extension passed English store version. Choosing automatically a backend for a website is not a good idea in our days. I am traveling around the world frequently and getting local IP's. I hate getting a website language version other than native without having the chance to choose other. Some visitors use proxies and their IP's change in the routers chain. Finally it is your decision.

My solution:

  1. I created a virtual Sever: mydomain.com with default settings...
  2. Created a sub-server: mydomain.es and realize the next workaround:
    • Open /etc/httpd/conf/httpd.conf
    • Find that VirtualHost (80 and 443) and change /home/mydomain/domains/mydomain.es/public_html to /home/mydomain/public_html in DocumentRoot Directive
    • Restart Apache.

And its working properly.

Any notes about it?

Thank you ADDISON74.

We auto-detect language via locale browser settings