Hi Anthony - 

Thank you for the post. 

The set up I have is one project with multiple websites all housed in the 
same CMS - Basically following the mezzanine docs for multi-tenancy 
http://mezzanine.jupo.org/docs/multi-tenancy.html

For other projects I have used configurations that somewhat resemble yours. 
It works great. However, on this current project we don't want editors to 
have to log in to multiple website admins. In our case we're trying to keep 
content for all our websites in the same CMS. 

However, your post has given me some ideas to try. If I can get something 
working I'll report back on how I did it. And more feedback is always 
welcome and helpful. 

Thanks again!
Matt

On Sunday, January 3, 2016 at 11:53:33 AM UTC-8, Anthony Gagliardo wrote:
>
> There are a few ways to set this up.  I've tried a couple of them out 
> personally and from my past experience I would say that the next step 
> depends upon how you have multitenancy set up.
>
> Typically I will use multiple django/mezzanine projects installed on the 
> same server, in completely separate dirs.  Each project has a domain name 
> (and an elastic ip associated with it), which is where nginx comes into the 
> mix.  Inside my nginx config I have several upstream servers defined. I use 
> one virtualhost for each of the projects plus whatever utility servers that 
> I might need.
>
> example upstream setup:
> upstream GUnicornSite1 {
>     server 127.0.0.1:8001;
> }
> upstream GUnicornSite2 {
>     server 127.0.0.1:8002;
> }
> upstream GUnicornSite3 {
>     server 127.0.0.1:8003;
> }
>
> Now that nginx knows about the webservers, its time to actually start 
> those webservers.  Its important to note that in your gunicorn 
> configuration, you need to make sure that each server is listening on 
> whichever port number you specified in your nginx.conf definition.  Aside 
> from any static media nonsense that may or may not arise, I don't think 
> there is much more to specify as far as the gUnicorn config.  I made the 
> move to uwsgi because I needed websocket support.
>
> The uwsgi part of my nginx.conf looks significantly different than what a 
> gunicorn setup needs, but here is a simple example of how I listen on a 
> certain port.
> Server{
>     listen 9001;
>     location / {
>        proxy_pass http://GUnicornServer1/;
>
> Server{
>     listen 9002;
>     location / {
>        proxy_pass http://GUnicornServer2/;
>
>
>
> You can also specify that you want to listen for a certain domain/ip 
> address, the syntax is a little tricky so i would suggest finding a good 
> tutorial that meets your needs.  So in the above case, if a request is sent 
> to port 9002, it will be forwarded to whichever website is running on the 
> 9002 server.  Again, instead of using port 9002 you could just as easily 
> route the request based on the ip.  I use this setup with uwsgi's emperor 
> mode because it makes managing the vassal servers simple.
>
>
>
> If you, instead, want to host multiple sites using multi-tenancy over a 
> single webserver then I would consider using middleware to route incoming 
> urls to the appropriate urls.py.  nginx should not need any additional 
> configuration, it just needs to route all the requests to the one 
> webserver.  Routing then happen when the request is processed by the 
> middleware. 
>
> There's probably an easier way to do this too that I'm not aware of.  I've 
> done subdomain routing like this in the past, but it felt kind of hacky.  I 
> feel like nginx is the more capable  solution.  I might be deploying a site 
> later today that involves this sort of setup.  If i get around to it ill 
> post the actual code chunks.
>
> best,
> avg
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to