New to all this so please bear with me. I have one existing website set up using nginx (fusiondiscordbots.com) however, I am wanting to add a second on the subdomain - dashboard.application-bot.com. The main domain is set to a GitHub.io site meanwhile the A records of the subdomain are pointed to the ip of my nginx hosting VPS. When I try to connect to the subdomain, I get served with my other site (fusiondiscordbots.com). I was wondering if anyone could help, I have coped all my config files below. Thank, Sean.
Nginx Config
server {
server_name www.dashboard.application-bot.com;
return 301 https://dashboard.application-bot.com$request_uri;
}
server {
listen 80;
server_name dashboard.application-bot.com;
location / {
return 301 https://dashboard.application-bot.com$request_uri;
}
}
server {
listen 443 ssl;
server_name dashboard.application-bot.com;
ssl_certificate /etc/letsencrypt/live/dashboard.application-bot.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/dashboard.application-bot.com/privkey.pem;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location / {
proxy_pass https://localhost:8004;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /static {
alias /var/www/application-web/app/static;
expires 30d;
}
}
Other nginx config file for fusiondiscordbots.com
server {
server_name www.fusiondiscordbots.com;
return 301 https://fusiondiscordbots.com$request_uri;
}
server {
listen 80;
server_name fusiondiscordbots.com;
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl;
server_name fusiondiscordbots.com;
ssl_certificate /etc/letsencrypt/live/fusiondiscordbots.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/fusiondiscordbots.com/privkey.pem;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location / {
proxy_pass https://localhost:8001;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /static {
alias /var/www/fusion-web/app/static;
expires 30d;
}
location /sitemap.xml {
alias /var/www/fusion-web/app/static/sitemap.xml;
expires 30d;
}
location /robot.txt {
alias /var/www/fusion-web/app/static/robot.txt;
expires 30d;
}
location /.well-known {
alias /var/www/fusion-web/app/static/;
expires 30d;
}
}
Any idea would be appreciated and if any more info is require, please ask. Thanks again.
/etc/nginx/sites-available
to/etc/nginx/sites-enabled
./etc/nginx/sites-enabled/applicationweb;
. That fixed the problem. Thanks for your ideas anyway.