I'm using nginx as my server. I have two domain names abc.com and xyz.com. Somehow I have configured abc.com to go to xyz.com but I cannot find where. I have a file under sites-enabled for each domain but the redirect is not there. I also checked nginx.conf and didn't see any redirects. Where can this redirect be coming from? Interesting thing is that when I remove abc.com server file from sites-enabled, I get the 404 error. The server file in sites-enabled looks something like:
server {
server_name www.abc.com default_server;
root /var/www/dev;
index index.php;
location / {
try_files $uri $uri/ @handler;
}
location @handler {
rewrite / /index.php;
}
location ^~ /html {
try_files $uri $uri/;
}
location ^~ /phpmyadmin {
alias /usr/share/phpmyadmin;
auth_basic "Admin Login";
auth_basic_user_file /etc/nginx/dbms_pass;
index index.php index.html index.htm;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
}
location ^~ /livehelp {
try_files $uri $uri/ /livehelp/index.php?$args;
location ~ /livehelp/.*\.php$ {
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
}
location ^~ /livehelp/operator {
try_files $uri $uri/ /livehelp/operator/index.php?$args;
location ~ /livehelp/operator/.*\.php$ {
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
}
# Denied locations require a "^~" to prevent regexes (such as the PHP handler below) from mat$
# http://nginx.org/en/docs/http/ngx_http_core_module.html#location
location ^~ /app/ { return 403; }
location ^~ /includes/ { return 403; }
location ^~ /media/downloadable/ { return 403; }
location ^~ /pkginfo/ { return 403; }
location ^~ /report/config.xml { return 403; }
location ^~ /var/ { return 403; }
location ^~ /lib/ { return 403; }
location ^~ /dev/ { return 403; }
location ^~ /RELEASE_NOTES.txt { return 403; }
location ^~ /downloader/pearlib { return 403; }
location ^~ /downloader/template { return 403; }
location ^~ /downloader/Maged { return 403; }
location ~* ^/errors/.+\.xml { return 403; }
location ^~ /rfqnet/ {return 403;}
location ~ .php/ {
rewrite ^(.*.php)/ $1 last;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include snippets/fastcgi-php.conf;
include fastcgi_params;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
set $MAGE_ROOT /var/www/dev;
set $MAGE_MODE developer;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/www.abc.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/www.abc.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = www.abc.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name www.abc.com;
}
Where can i check to find the cause of this unwanted redirect?