I have a Wordpress site in abc.com, and a Rails app in app.xyz.com, same server. Take note of different domain. But when I type abc.com, it shows content in app.xyz.com, and in the address bar shows abc.com. What have I done wrong?
nginx config file for abc.com
server {
listen 80;
root /var/www/abc;
index index.php index.html index.htm index.nginx-debian.html;
server_name abc.com;
client_max_body_size 20M;
location / {
#try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
}
location ~ /\.ht {
deny all;
}
location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { log_not_found off; access_log off; allow all; }
location ~ ^/\.user\.ini {
deny all;
}
location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
expires max;
log_not_found off;
}
}
nginx config file for app.xyz.com
upstream xyz {
server unix:/home/deployer/app/shared/tmp/sockets/puma.sock fail_timeout=0;
}
server {
listen 80;
server_name app.xyz.com;
client_max_body_size 4G;
keepalive_timeout 10;
error_page 500 502 503 504 /500;
root /home/deployer/app/current/public;
try_files $uri/index.html $uri.html $uri @app;
location @app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://xyz;
}
location = /50x.html {
root html;
}
location = /404.html {
root html;
}
location @503 {
error_page 405 = /system/maintenance.html;
if (-f $document_root/system/maintenance.html) {
rewrite ^(.*)$ /system/maintenance.html break;
}
rewrite ^(.*)$ /503.html break;
}
if ($request_method !~ ^(GET|HEAD|PUT|PATCH|POST|DELETE|OPTIONS)$ ){
return 405;
}
if (-f $document_root/system/maintenance.html) {
return 503;
}
}
In nginx config file for abc.com, add this on top: