Second domain config does not redirect www traffic

macmichael01 nginx-forum at nginx.us
Thu Feb 19 06:59:03 UTC 2015


Hello, I have ngnix installed to serve up to websites. The first one is
behind is behind SSL and should redirect everything to https://EXAMPLE1.com.
This works perfectly as for the second website, its only being hosted on
http. All www traffic should redirect to non-www but it fails.

Here is my nginx config: http://pastie.org/private/ziromp4jqkbxehk5xjiha

Does conf loading order matter? These are the files as they appear in the
nginx conf directory:
sites-enabled/EXAMPLE1.conf
sites-enabled/EXAMPLE2.conf

Could this be a DNS issue?
www.EXAMPLE1.com, www.example2.com, example1.com, example2.com all have A
Host name records defined. Should I use a Cname record for the www.* names

Here is what works and what fails:
WORKS - http://www.EXAMPLE1.com redirects to https://EXAMPLE1.com
WORKS - http://EXAMPLE1.com redirects to https://EXAMPLE1.com
WORKS - https://EXAMPLE1.com

WORKS - http://EXAMPLE2.com
BROKE - http://www.EXAMPLE2.com fails to redirect to http://EXAMPLE2.com. I
get a welcome to nginx screen.

Any ideas? Thanks so much for any help that can be provided!

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,256780,256780#msg-256780



More information about the nginx mailing list