Vaultwarden.domain.com does not work

My server is set up using Fastpanel.direct. It uses nginx on port 80.

I set up a vaultwarden file in fastpanel2-available and I also have domain plus 1 other website set up there. domain plus the other one works fine.

When I visit vaultwarden.domain I just get the fastpanel splash page. It is secure and https://vaultwarden.domain does the same thing. I use Brave and happens in a normal tab and private browsing tab.

I have rebooted nginx… I use CloudFlare for domain and I set up vaultwarden.domain to point to my server’s IP.

This is the vaultwarden file in fastpanel2-available…

# The `upstream` directives ensure that you have a http/1.1 connection
# This enables the keepalive option and better performance
#
# Define the server IP and ports here.
upstream vaultwarden-default {
  zone vaultwarden-default 64k;
  server MYSERVERIP:8080;
  keepalive 2;
}
upstream vaultwarden-ws {
  zone vaultwarden-ws 64k;
  server MYSERVERIP:3012;
  keepalive 2;
}

# Redirect HTTP to HTTPS
server {
    listen 80;
    listen [::]:80;
    server_name vaultwarden.domain.com;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name vaultwarden.domain.com;

    # Specify SSL Config when needed
    #ssl_certificate /path/to/certificate/letsencrypt/live/vaultwarden.example.tld/fullchain.pem;
    #ssl_certificate_key /path/to/certificate/letsencrypt/live/vaultwarden.example.tld/privkey.pem;
    #ssl_trusted_certificate /path/to/certificate/letsencrypt/live/vaultwarden.example.tld/fullchain.pem;

    client_max_body_size 128M;

    location / {
      proxy_http_version 1.1;
      proxy_set_header "Connection" "";

      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;

      proxy_pass http://vaultwarden-default;
    }

    location /notifications/hub/negotiate {
      proxy_http_version 1.1;
      proxy_set_header "Connection" "";

      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;

      proxy_pass http://vaultwarden-default;
    }

    location /notifications/hub {
      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "upgrade";

      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header Forwarded $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;

      proxy_pass http://vaultwarden-ws;
    }

    # Optionally add extra authentication besides the ADMIN_TOKEN
    # Remove the comments below `#` and create the htpasswd_file to have it active
    #
    #location /admin {
    #  # See: https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/
    #  auth_basic "Private";
    #  auth_basic_user_file /path/to/htpasswd_file;
    #
    #  proxy_http_version 1.1;
    #  proxy_set_header "Connection" "";
    #
    #  proxy_set_header Host $host;
    #  proxy_set_header X-Real-IP $remote_addr;
    #  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    #  proxy_set_header X-Forwarded-Proto $scheme;
    #
    #  proxy_pass http://vaultwarden-default;
    #}
}

Did I set this up correctly?

I do not see any fastpanel settings that could be causing this.

I am still not familiar with fastpanel however in the #vaultwarden:matrix.org room on Matrix we found out that:

  1. Files in /etc/nginx/fastpanel2-available/ are not included according to /etc/nginx/nginx.conf so the vaultwarden configuration file needs to be renamed and moved to the right location and/or enabled via a symbolic link.
  2. the ssl_certificate and ssl_certificate_key are still commented out in the configuration posted here. They should point to the generated Let’s encrypt TLS certificates fullchain.pem and privkey.pem respectively which are usually found in /etc/letsencrypt/live/<domain>/ (atleast when generated with certbot but YMMV with fastpanel).

After fixing the configuration and placing the file in the right directory, you then should be able to restart nginx (but you might want to check with sudo nginx -t if you have any syntax errors).