1👍
✅
I’m not going to sanitize and validate your configuration files, but they contain several problems and you should DRY them out.
Regarding your actual question.
- You haven’t configured any redirects and nginx is therefore happily redirecting those subdomains to your default server.
- You haven’t configured a default server and nginx is simply using the very first defined server as default server (in your case
site
sincesite2
andsite3
come after that one; simple sort).
The actual solution is to configure the redirects you want to happen for each of your servers. This snippet is taken from another answer of mine on a similar question.
server {
#listen 80 is default
server_name www.example.com;
return 301 $scheme://example.com$request_uri;
}
server {
#listen 80 is default
server_name example.com;
## here goes the rest of your conf...
}
0👍
you need
server {
listen 80;
server_name mysite1.com;
return 301 http://www.mysite1.com$request_uri;
}
server {
listen 80;
server_name www.mysite1.com;
# other stuff...
}
this redirects non-www to www
and www to www
. you need this config for each of those 3 domains..
- [Answer]-Django Test Client does not create a user object but creates a anonymous user object
- [Answer]-'AnonymousUser' object has no attribute 'backend' customuser
- [Answer]-Adding FieldFile objects without form in django
- [Answer]-Issues with uploading images to a carousel
Source:stackexchange.com