Trying to understand how to force www. in my domain and redirect anything like ww.example.com or test.example.com -> www.example.com
Everything works fine when I go to www.example.com or example.com, I'm just trying cover myself if people try going to the wrong domain and I shouldnt have to add anything more than 'www.example.com' and 'example.com' in my django ALLOWED_HOSTS
i set everything up according to:
How To Use the Django One-Click Install Image
upstream app_server {
server 127.0.0.1:9000 fail_timeout=0;
}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
client_max_body_size 4G;
server_name _;
keepalive_timeout 5;
# Your Django project's media files - amend as required
location /media {
alias /home/django/django_project/django_project/media;
}
# your Django project's static files - amend as required
location /static {
alias /home/django/django_project/django_project/static;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app_server;
}
}