Hello, I've got a domain example.com
and an "alternative" of some-example.com
. I'm trying to direct traffic from some-example.com
to example.com
using a simple server declaration in nginx as follows:
server {
listen 80;
server_name some-example.com;
rewrite ^/(.*) http://example.com/$1 permanent;
}
I'm not 100% sure if this is the right rule, but I've got another vhost on the server, this isn't where the problem is, but it's necessary to understand the issue I'm having.
server {
listen 8745;
server_name localhost;
<other stuff goes here>
}
Hitting <my server IP>:8745
will go to that vhost, that works as intended. However I've got another vhost like this:
server {
listen 8746;
server_name localhost;
<other stuff goes here>
}
But all of my requests to <my server IP>:8746
hit example.com
. I'm... baffled, I don't really grok nginx, so any help would be appreciated as to why this is happening. I mentioned that rule in the beginning because I'm thinking it has something to do with this. If additional information is needed I can supply it.
(Also, would this be better for Server Fault?)