0

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.

5
  • what happens if you try with a different browser? 301 redirects are "permanent" and cached by the browser
    – ignivs
    Apr 21, 2019 at 19:18
  • 2
    I think you haven't started nginx with this configuration. Restart it. Apr 21, 2019 at 19:21
  • I have restarted it and tried it again in Firefox (which I have just downloaded), it still serves up the fusion website.
    – Sean Hatch
    Apr 21, 2019 at 21:34
  • If your OS is Debian / Ubuntu Linux, you might have missed to setup the symbolic link from /etc/nginx/sites-available to /etc/nginx/sites-enabled. Apr 21, 2019 at 22:21
  • Turns out I forgot to add it to the main nginx config file using include /etc/nginx/sites-enabled/applicationweb; . That fixed the problem. Thanks for your ideas anyway.
    – Sean Hatch
    Apr 22, 2019 at 9:32

0

You must log in to answer this question.

Browse other questions tagged .