Nginx www to root redirection not working
this is my nginx config
upstream django {
server unix:///var/tmp/******.sock;
}
server {
listen 80;
server_name mydomain.com;
charset utf-8;
client_max_body_size 75M;
location /static {
alias **********;
}
location / {
uwsgi_pass ********;
include *************;
}
}
server {
listen 80;
server_name www.mydomain.com;
return 301 $scheme://mydomain.com$request_uri;
}
here mydomain is working fine
when i go to www.mydomain i am not getting redirected.
and lands on nginx default page.
It's fixed i just had to move the redirection server block before the root domain block