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

Resolve subdomains for tenants in production with Nginx #327

Closed
Ngahu opened this issue Dec 10, 2019 · 7 comments
Closed

Resolve subdomains for tenants in production with Nginx #327

Ngahu opened this issue Dec 10, 2019 · 7 comments

Comments

@Ngahu
Copy link

Ngahu commented Dec 10, 2019

I have a project using django-tenants .On localhost , I can access localhost:8000 and tenant.localhost:8000 pretty fine. However, in production, only the public tenant is loading the other tenants can't be reached. What could be the issue?

Here is my ALLOWED_HOSTS = ['.example.com']
and my Nginx conf is as below;

server {
listen 80 default_server;
listen [::]:80 default_server;
server_name *.example.com;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/ubuntu/projects/myproject;
}
location / {
include proxy_params;
proxy_pass http://unix:/run/gunicorn.sock;
}
}

@tomturner
Copy link
Member

Have you got a wildcard in your DNS settings

@Ngahu
Copy link
Author

Ngahu commented Dec 10, 2019

Just added it and it has worked. Thanks!!

@Ngahu Ngahu closed this as completed Dec 10, 2019
@tomturner
Copy link
Member

@Ngahu No problem 😄

@alxroots
Copy link

@Ngahu I am facing the same problem, what is wildcard you have put on your solution? how did you set it up? Thanks

@Ngahu
Copy link
Author

Ngahu commented Feb 20, 2020

On your DNS Management page create a type A record and use * as the Host Name

@drayendrff
Copy link

I created a wildcard but it seems that it is not calling django to redirect on nginx on ubuntu

@drayendrff
Copy link

Have you got a wildcard in your DNS settings

I have the wildcard A DNS with * but when I try to access the subdomain it doesn't display the login page

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

4 participants