Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to have multiple istances? #55

Open
olivierognn opened this issue Sep 13, 2018 · 1 comment
Open

How to have multiple istances? #55

olivierognn opened this issue Sep 13, 2018 · 1 comment

Comments

@olivierognn
Copy link

Is possible to have multiple istances of magento website on the same server?
What I need to change?

@andreaskoch
Copy link
Owner

Hi @olivierognn.
Yes, it is possible to run multiple instances at the same time. You have three options:

Option 1: Multiple Public IPs

If your server has multiple IP addresses you can bind the web ports of the different instances to the different IP addresses (see: docker-compose.yml)

Instance 1:

nginx:
  image: nginx:latest
  ports:
    - "192.168.2.2:80:80"
    - "192.168.2.2:443:443"

Instance 2:

nginx:
  image: nginx:latest
  ports:
    - "192.168.2.3:80:80"
    - "192.168.2.3:443:443"

Option 2: Using High Ports

If you don't have have multiple IP addresses available you can use different public ports - this is only a viable option for internally used shops:

Instance 1:

nginx:
  image: nginx:latest
  ports:
    - "80:80"
    - "443:443"

Instance 2:

nginx:
  image: nginx:latest
  ports:
    - "6080:80"
    - "60443:443"

Option 3: Reverse Proxy

Or can can put a reverse proxy in front of the two instances which routes the traffic based on the hostname.

  • Request for site1.example.com: Nginx on port 80 -> Site 1 (127.0.0.2:80)
  • Request for site2.example.com: Nginx on port 80 -> Site 1 (127.0.0.3:80)

In that case I would recommend to run the Nginx natively und bind the two instances to local IP addreses (e.g. 127.0.0.2, 127.0.0.3):

Instance 1:

nginx:
  image: nginx:latest
  ports:
    - "127.0.0.2:80:80"
    - "127.0.0.2:443:443"

Instance 2:

nginx:
  image: nginx:latest
  ports:
    - "127.0.0.3:80:80"
    - "127.0.0.3:443:443"

Whenever possible I would use Option 1. That's easiest to setup and maintain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants