Bitwarden Server Setup Problem (Using Nonstandard Port 4430)

@Clare_Clever Welcome to the forum!

This is not within my expertise, but to help you get assistance, please post information about the server version you are running (see instructions for determining server version), as well as the OS that the server is installed on.

I am running my home server on Ubuntu Server 22.10. I haven’t been able to get to my admin page. I see that you can access the admin page by going here… your . domain . com/admin (it doesn’t have the spaces like that, the forum won’t let me post with more than two links). My default URL looks like this, https:// your . domain . com:4430/ (again, remove the spaces in my example). I set it up to run on 4430, as port 443 was already being used by Nextcloud. I was thinking that the URL for the admin page would be https://your.domain.com:4430/admin or https://your.domain.com/admin:4430… but neither of those worked. How do you reach the admin page when you have it running on a different port than the default value?

As for my Bitwarden version, I just installed all of this yesterday so it should be the latest version available for my OS.

Just to make sure we know what you’re running, where did you download to server code from (or which set of download/installation instructions did you follow?)?

I followed these instructions… Install and Deploy - Linux | Bitwarden Help Center. They where very straight forward and pretty easy to follow. I got all the way to the last step and was even able to access my new Bitwarden URL on the DNS address I created. When I went to go create a new account it gave me those server errors (as seen above). Let me know if you would like for me to provide any more information.

Thanks for all of your help!

Thanks for providing the needed information. Hopefully someone with more knowledge of Linux server setup will come by and help further (@cksapp?), and don’t forget that you can also turn to the official support channel.

I suspect that part of the issue may be related to your use of a nonstandard server port, so I have taken the liberty of modifying your post title accordingly (to give it better visibility).

As far as I recall the use of custom ports is supported in the standard install. I know there have been a few threads here in the community around the topic as well.

As far as for the OP, @Clare_Clever you may try to look into the application logs to see if that can give you some guidance to what went wrong a bit more in depth.


Otherwise I would initially suspect it may be some conflict due to your Nextinstall on the same host.

Do you know if you have another reserve proxy installed that handles Nextcloud apart from the built in nginx that comes with the Bitwarden install?

Otherwise I would also highly recommend reaching out to the official support as linked above, as they will be able to further support and assist you as well.

One other thing I can think to possibly verify, were you able to successfully set up SMTP?

Also as noted after configuring your SMTP settings, you’ll want to apply this by running

./bitwarden.sh rebuild
./bitwarden.sh restart

Ok, well I think I figured it out. It’s always something very small and often silly. Here is what happened… I created a custom MS account and Outlook profile for my home server to use. For some reason, it didn’t like the default Biwarden setup configuring the reply-to email to no-reply@XXXXX. I changed that value back to my regular email address and it’s all working now.

Also, while testing all of this I may have come across a few bugs. As you know I set up my instance to run on port 4430, it’s all working now. When I go to my admin page and request a link be sent to my email address the link comes in, but it doesn’t have my altered port in the link so the link in the email is broken. The same things happens when I create a user account and it sends me a link to click on to verify my account. It takes me to my server address but on port 443 instead of my custom port of 4430. I was able to just modify the link in the emails I received to change them to port 4430 and that brought up the respective pages as I expected. Let me know if you need any more info on those two issues I found.

Thanks @grb and @cksapp for all of your help in pointing me in the correct direction!

Glad you got it working.

 

Good find — pinging @bw-admin so he can bring this to the developer’s attention.

Hey @Clare_Clever feel free to report bugs here with steps to reproduce.

I had a feeling this sounded familiar, it seems that another user in the community was facing something similar.

Can you verify if once you made your port changes in the config.yml and then running .\bitwarden.sh rebuild also should add the ports to your ./bwdata/env/global.override.env
If this data did not carry over, and you have to manually alter the global.override.env as directed in the other post, then I would say it appears to be reproducable and to detail the findings in a bug report on the appropriate GitHub repos as linked.

@cksapp, thanks for the additional information. I went in and changed globalSettings__baseServiceUri__vault in the bwdata/env/global.override.env file and URL in the bwdata/config.yml file. It now lists my URL as https://my.domain.org:4430 in both of those places. I rebuilt Bitwarden and restarted it and am now running into another issue. I can reach the regular site by going to my URL as seen above. I was able to create a new user and the email that was sent has the correct link in it now, that part is working! I then tried to go to my admin portal at https://my.domain.org:4430/admin and am getting this error in the browser…
image

I checked the nginx logs and this is what I saw…

2023/03/08 01:02:26 [error] 48#48: *1 connect() failed (111: Connection refused) while connecting to upstream, client: MY_ROUTER_IP, server: my.domain.org, request: "GET /admin HTTP/2.0", upstream: "http://my_ip:5000/admin", host: "my.domain.org:4430"

I checked my firewall on my server and my router and nothing has changed since I had it working before. Not sure why it’s running into issues getting to the admin page now. I have tried to troubleshoot it a lot but to no avail. I have tried reinstalling and using different setup keys and still can’t gain access to the admin page, even when I revert my changes back to what I had before.

Am I missing something? Have you seen this issue happen before?

Please let me know if you’d like for me to provide any more information or if you have any ideas.

Thanks!

So just to confirm this did not automatically get added after changing and applying settings in the comfig.yml and you had to manually enter this data into the global.override.env file?
This definitely is contrary to the documentation on how this should function.


Glad to hear and confirm that this did actual enter the custom port into the emails as needed!

As far as your issue, I can’t say that I have personal run into this myself. I have been searching and found somewhat related topics on GitHub and here in the community regarding the “502 Bad Gateway” error as well, though little seems to be related.

When you say “my_ip” is this the IP of the Bitwarden host, or your machine used to access the server?
The port 5000 is an internal port to the docker network stack, so there may be something wrong with the health of your install.

Can you run docker ps and check the output?

Correct, altering my URL in the comfig.yml file and rebuilding Bitwarden produces no change in the global.override.env file.

Here is the output of the docker ps command:

CONTAINER ID   IMAGE                                COMMAND                  CREATED              STATUS                        PORTS                                                                                                                                   NAMES
91fa372a7e72   bitwarden/nginx:2023.2.1             "/entrypoint.sh"         About a minute ago   Up About a minute (healthy)   80/tcp, 0.0.0.0:8000->8080/tcp, :::8000->8080/tcp, 0.0.0.0:4430->8443/tcp, :::4430->8443/tcp                                            bitwarden-nginx
c1ac9af6434f   bitwarden/admin:2023.2.1             "/entrypoint.sh"         About a minute ago   Up About a minute (healthy)   5000/tcp                                                                                                                                bitwarden-admin
b11d637bdc52   bitwarden/web:2023.2.0               "/entrypoint.sh"         About a minute ago   Up About a minute (healthy)                                                                                                                                           bitwarden-web
149acb1c5692   bitwarden/api:2023.2.1               "/entrypoint.sh"         About a minute ago   Up About a minute (healthy)   5000/tcp                                                                                                                                bitwarden-api
5c7de6826402   bitwarden/attachments:2023.2.1       "/entrypoint.sh"         About a minute ago   Up About a minute (healthy)                                                                                                                                           bitwarden-attachments
ce06f9dd7214   bitwarden/sso:2023.2.1               "/entrypoint.sh"         About a minute ago   Up About a minute (healthy)   5000/tcp                                                                                                                                bitwarden-sso
368ecc07ca7f   bitwarden/mssql:2023.2.1             "/entrypoint.sh"         About a minute ago   Up About a minute (healthy)                                                                                                                                           bitwarden-mssql
592f7ca55d93   bitwarden/notifications:2023.2.1     "/entrypoint.sh"         About a minute ago   Up About a minute (healthy)   5000/tcp                                                                                                                                bitwarden-notifications
1983c8658e1b   bitwarden/icons:2023.2.1             "/entrypoint.sh"         About a minute ago   Up About a minute (healthy)   5000/tcp                                                                                                                                bitwarden-icons
49e57583b057   bitwarden/events:2023.2.1            "/entrypoint.sh"         About a minute ago   Up About a minute (healthy)   5000/tcp                                                                                                                                bitwarden-events
bf268dc36685   bitwarden/identity:2023.2.1          "/entrypoint.sh"         About a minute ago   Up About a minute (healthy)   5000/tcp                                                                                                                                bitwarden-identity
20365c559b69   nextcloud/all-in-one:latest          "start.sh /usr/bin/s…"   3 days ago           Up 25 hours (healthy)         0.0.0.0:8080->8080/tcp, :::8080->8080/tcp, 0.0.0.0:8443->8443/tcp, :::8443->8443/tcp, 9000/tcp, 0.0.0.0:8888->80/tcp, :::8888->80/tcp   nextcloud-aio-mastercontainer
65390ab0fdc9   lscr.io/linuxserver/duckdns:latest   "/init"                  4 months ago         Up 25 hours                                                                                                                                                           duckdns

I am not sure… I guess it’s the IP of the Bitwarden Host. I grepped for the IP and it wasn’t in my ifconfig output on my home server.

@cksapp, I was thinking it was possibly an incompatibility with Nextcloud… However, I just stopped all of my Nextcloud docker containers (and rebooted my home server) and am still experiencing the same issue while trying to connect to the admin page. This Github issue ( connect() failed (111: Connection refused) while connecting to upstream · Issue #2544 · bitwarden/server (github.com)) has a similar error to the one that I am getting in my nginx logs, one of the people in the comments said to alter the defualt.conf file… the one that gets overwritten when you rebuild the project. I tried that, but as you’d expect… it didn’t work and was overwritten.

Mhmmm going off your docker ps output everything looks healthy.

Possibly check to see if the solution here may be applicable to your default.config file?

It seems this appears to be common with another user having similar issues to the “web” vs “bitwarden-web”


Although at this point, I would highly recommend to contact the official support team if you haven’t already.
Though I would be very interested for you to report back still to what the resolution is.

I just gave that a try and it is still running into the same issue. It’s odd that it worked the first time I installed it. I have tried to reinstall it several times and it has never been the same. Maybe there are still remnants of the past install laying around. @cksapp, do you know of any way that I can start on a fresh slate?

Yeah, I’ll go ahead and create a ticket with the official support team and will report back my findings.

1 Like

Hopefully support can provide you with some good answers.

I would say it depends on how far deep in the rabbit hole you are currently.

Are you just starting and do not care for anything to be saved?

  • If so then you can just simply delete the entire ./bwdata directory and start from scratch.

If you have items saved in your vault that you wish to keep.

  • At a minimum I would recommend making a backup of your vault from the client. (Though note this doesn’t save any attachments, or some additional metadata such as password history)

  • You may also wish to backup directly from the host the following

    • ./bwdata/mssql directory which will contain the SQL database and backups for all your entries
    • ./bwdata/core/attachments/ directory which contains encrypted file attachments

This Help doc may also assist with the Host-to-host option.