Configuration for multiple hosts on one Dotcloud PHP service

268 Views Asked by At

I am creating an application on DotCloud where I want to host multiple websites using the same PHP service. I already have one site up and running with the "approot" of that site set to a subfolder of my codebase in my dotcloud.yml file.

I'm guessing that I need to remove my approot definition from my dotcloud.yml file then wrap my nginx.conf settings for each subfolder site in a "server" declaration with the server_name set to my alias domain and the root set to the subfolder for that domain. Unfortunately, because I cannot add aliases to a "sandbox" app, I have no way to test a configuration like this without creating another "live" app.

How do I configure my dotcloud.yml file and nginx.conf files to have one alias point at one subfolder (my current approot) and have a second alias point to a different subfolder (a completely different site and domain) on the same PHP service?

1

There are 1 best solutions below

2
On

Not sure if this is exactly what you are looking for but. You could have one dotCloud.yml with multiple services each pointing to a different approot.

dotcloud.yml

php1:
   type: php
   approot: site_1
php2:
   type: php
   approot: site_2
db:
   type: mysql

then you could use the command line to assign a different alias to each service.

$ dotcloud alias add app.php1 www.example1.com

$ dotcloud alias add app.php2 www.example2.com

Another option:

If you write your code to be multi-tenet then you can look at the host coming in the header of the request and serve up different websites from the same code base. Django does this pretty much out the box on the python side. Not sure if there is something like it with php.