# Setting up self-hosted - error when trying to register

**URL:** <https://community.bitwarden.com/t/setting-up-self-hosted-error-when-trying-to-register/38484>\
**Category:** Password Manager\
**Created:** [February 22, 2022, 2:08pm UTC](https://community.bitwarden.com/t/setting-up-self-hosted-error-when-trying-to-register/38484 "2022-02-22T14:08:00Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![littlephil](https://avatars.discourse-cdn.com/v4/letter/l/4bbf92/32.png) [@littlephil](https://community.bitwarden.com/u/littlephil)\
**Post date:** [February 22, 2022, 2:08pm UTC](https://community.bitwarden.com/t/setting-up-self-hosted-error-when-trying-to-register/38484/1 "2022-02-22T14:08:01Z")

</div>

I am trying to setup self-hosted and it all seems to be ok except when I try to register a new account.

It takes ages and then briefly shows an error saying “an unhandled server error has occured”

I did some research and did find a post suggesting it was my mail settings in the global.override.env file but from what I can tell these are all correct.

I’m trying to relay via Office365, I’ve created a connector, created an app password, checked the firewall port is open and i still can’t get it to work. I even wiped the installation and started again.

 ![image](https://us1.discourse-cdn.com/flex001/uploads/bitwarden1/original/3X/1/b/1b2e3b44676ed3df39f758f301cac7da2f8b4a64.png)

Does anyone have any ideas/clues what I can do?

Thank you  
Phil

---

<div class="post-metadata">

**Author:** ![dh024](https://sea1.discourse-cdn.com/flex001/user_avatar/community.bitwarden.com/dh024/32/17854_2.png) [@dh024](https://community.bitwarden.com/u/dh024)\
**Post date:** [February 22, 2022, 2:19pm UTC](https://community.bitwarden.com/t/setting-up-self-hosted-error-when-trying-to-register/38484/2 "2022-02-22T14:19:27Z")

</div>

Hi @littlephil - welcome to the forums!

Does your Office365 account require 2FA? If so, you are going to need to generate an app password:

[https://support.microsoft.com/en-us/account-billing/manage-app-passwords-for-two-step-verification-d6dc8c6d-4bf7-4851-ad95-6d07799387e9](https://support.microsoft.com/en-us/account-billing/manage-app-passwords-for-two-step-verification-d6dc8c6d-4bf7-4851-ad95-6d07799387e9)

---

<div class="post-metadata">

**Author:** ![littlephil](https://avatars.discourse-cdn.com/v4/letter/l/4bbf92/32.png) [@littlephil](https://community.bitwarden.com/u/littlephil)\
**Post date:** [February 22, 2022, 2:22pm UTC](https://community.bitwarden.com/t/setting-up-self-hosted-error-when-trying-to-register/38484/3 "2022-02-22T14:22:08Z")

</div>

Hi thanks for the welcome.

Yes it does use 2FA and I did create an app password. Am I right in that this just goes into the password field?

---

<div class="post-metadata">

**Author:** ![dh024](https://sea1.discourse-cdn.com/flex001/user_avatar/community.bitwarden.com/dh024/32/17854_2.png) [@dh024](https://community.bitwarden.com/u/dh024)\
**Post date:** [February 22, 2022, 2:27pm UTC](https://community.bitwarden.com/t/setting-up-self-hosted-error-when-trying-to-register/38484/4 "2022-02-22T14:27:53Z")

</div>

Yes, correct. So it sounds like it must be something else.

You might try adding this line to see if it helps:

`globalSettings __mail__ smtp__startTls=true`

---

<div class="post-metadata">

**Author:** ![littlephil](https://avatars.discourse-cdn.com/v4/letter/l/4bbf92/32.png) [@littlephil](https://community.bitwarden.com/u/littlephil)\
**Post date:** [February 22, 2022, 2:43pm UTC](https://community.bitwarden.com/t/setting-up-self-hosted-error-when-trying-to-register/38484/5 "2022-02-22T14:43:53Z")

</div>

Same sadly, is there a way to test if the server is the probelm or if its bitwarden/my config?

---

<div class="post-metadata">

**Author:** ![dh024](https://sea1.discourse-cdn.com/flex001/user_avatar/community.bitwarden.com/dh024/32/17854_2.png) [@dh024](https://community.bitwarden.com/u/dh024)\
**Post date:** [February 22, 2022, 2:46pm UTC](https://community.bitwarden.com/t/setting-up-self-hosted-error-when-trying-to-register/38484/6 "2022-02-22T14:46:05Z")

</div>

You can check the logs to see if there are any clues.

Otherwise, can you try a different SMTP server? Gmail (no 2FA) is always a good test option.

---

<div class="post-metadata">

**Author:** ![littlephil](https://avatars.discourse-cdn.com/v4/letter/l/4bbf92/32.png) [@littlephil](https://community.bitwarden.com/u/littlephil)\
**Post date:** [February 22, 2022, 3:36pm UTC](https://community.bitwarden.com/t/setting-up-self-hosted-error-when-trying-to-register/38484/7 "2022-02-22T15:36:23Z")

</div>

I’ve now tried with gmail and the same thing occurs.

Am i right in that i am editting the file called global.override.env and then restarting each time I make a change by typing command ./bitwarden.sh restart?

 ![image](https://us1.discourse-cdn.com/flex001/uploads/bitwarden1/original/3X/b/9/b9cc946754130990456ddf6c50bc47e8de429f93.png)

---

<div class="post-metadata">

**Author:** ![dh024](https://sea1.discourse-cdn.com/flex001/user_avatar/community.bitwarden.com/dh024/32/17854_2.png) [@dh024](https://community.bitwarden.com/u/dh024)\
**Post date:** [February 22, 2022, 3:39pm UTC](https://community.bitwarden.com/t/setting-up-self-hosted-error-when-trying-to-register/38484/8 "2022-02-22T15:39:02Z")

</div>

No, I think you need to do a ./bitwarden.sh rebuild

> **[Configure Environment Variables | Bitwarden Help & Support](https://bitwarden.com/help/environment-variables/)**
>
> Customers who self-host the Bitwarden password manager will find in this article a selection of commonly used environment variables for configuring their server.

---

<div class="post-metadata">

**Author:** ![littlephil](https://avatars.discourse-cdn.com/v4/letter/l/4bbf92/32.png) [@littlephil](https://community.bitwarden.com/u/littlephil)\
**Post date:** [February 22, 2022, 3:42pm UTC](https://community.bitwarden.com/t/setting-up-self-hosted-error-when-trying-to-register/38484/9 "2022-02-22T15:42:15Z")

</div>

I’ll try now 🙂

---

<div class="post-metadata">

**Author:** ![dh024](https://sea1.discourse-cdn.com/flex001/user_avatar/community.bitwarden.com/dh024/32/17854_2.png) [@dh024](https://community.bitwarden.com/u/dh024)\
**Post date:** [February 22, 2022, 3:51pm UTC](https://community.bitwarden.com/t/setting-up-self-hosted-error-when-trying-to-register/38484/10 "2022-02-22T15:51:45Z")

</div>

Also, I am not sure that Gmail SMTP uses StartTLS for authentication, so you might have to remove that line if trying with Gmail or set the value to false.

---

<div class="post-metadata">

**Author:** ![littlephil](https://avatars.discourse-cdn.com/v4/letter/l/4bbf92/32.png) [@littlephil](https://community.bitwarden.com/u/littlephil)\
**Post date:** [February 22, 2022, 4:43pm UTC](https://community.bitwarden.com/t/setting-up-self-hosted-error-when-trying-to-register/38484/11 "2022-02-22T16:43:19Z")

</div>

I think I’ve tried every combination of the configuration now ☹

I somehow need to see if I can send mail via gmail or O365 outside of the bitlocker environment so I can rule out where the issue might be.

---

<div class="post-metadata">

**Author:** ![dh024](https://sea1.discourse-cdn.com/flex001/user_avatar/community.bitwarden.com/dh024/32/17854_2.png) [@dh024](https://community.bitwarden.com/u/dh024)\
**Post date:** [February 22, 2022, 4:44pm UTC](https://community.bitwarden.com/t/setting-up-self-hosted-error-when-trying-to-register/38484/12 "2022-02-22T16:44:32Z")

</div>

Sorry to hear that it still isn’t working. Good luck!

---

<div class="post-metadata">

**Author:** ![littlephil](https://avatars.discourse-cdn.com/v4/letter/l/4bbf92/32.png) [@littlephil](https://community.bitwarden.com/u/littlephil)\
**Post date:** [February 22, 2022, 5:27pm UTC](https://community.bitwarden.com/t/setting-up-self-hosted-error-when-trying-to-register/38484/13 "2022-02-22T17:27:06Z")

</div>

I now know these settings work!

 ![image](https://us1.discourse-cdn.com/flex001/uploads/bitwarden1/original/3X/5/1/51d9e5ce09e4f8f3e54faf85f2f0aaa9f169accd.png)

Do you know if the mail “sends from” my server, or if it somehow goes via Bitwarden?

I ask becuase I have to tell O365 the orignating ip and I’ve set that as the server’s WAN address.

Thanks for your help and patience so far.

---

<div class="post-metadata">

**Author:** ![dh024](https://sea1.discourse-cdn.com/flex001/user_avatar/community.bitwarden.com/dh024/32/17854_2.png) [@dh024](https://community.bitwarden.com/u/dh024)\
**Post date:** [February 22, 2022, 5:47pm UTC](https://community.bitwarden.com/t/setting-up-self-hosted-error-when-trying-to-register/38484/14 "2022-02-22T17:47:44Z")

</div>

No, it should send the message directly from your server.

I am not sure what to suggest now, other than make sure you are using the `rebuild` parameter for the `bitwarden.sh` script and check the log for any clues to why it is failing.

Perhaps some others here may have encountered this problem and can suggest a solution?

---

<div class="post-metadata">

**Author:** ![littlephil](https://avatars.discourse-cdn.com/v4/letter/l/4bbf92/32.png) [@littlephil](https://community.bitwarden.com/u/littlephil)\
**Post date:** [February 23, 2022, 3:33pm UTC](https://community.bitwarden.com/t/setting-up-self-hosted-error-when-trying-to-register/38484/15 "2022-02-23T15:33:39Z")

</div>

I’m abou to give up. I’ve tried multiple combinations of setting and different servers. I’ve even installed it fresh on an AWS server.

I don’t know how to look at any of the logs!

I’ve apreciated all your time trying to help me, thank you 🙂

Phil

---

<div class="post-metadata">

**Author:** ![dh024](https://sea1.discourse-cdn.com/flex001/user_avatar/community.bitwarden.com/dh024/32/17854_2.png) [@dh024](https://community.bitwarden.com/u/dh024)\
**Post date:** [February 23, 2022, 3:40pm UTC](https://community.bitwarden.com/t/setting-up-self-hosted-error-when-trying-to-register/38484/16 "2022-02-23T15:40:23Z")

</div>

Hi Phil - sorry to hear this. Before you pack it in, you might want to reach out to the Bitwarden CS team to see if they can help at all:

> **[Get in Touch | Bitwarden](https://bitwarden.com/contact/)**
>
> Contact the Bitwarden team for support help or sales inquiries.

---

<div class="post-metadata">

**Author:** ![littlephil](https://avatars.discourse-cdn.com/v4/letter/l/4bbf92/32.png) [@littlephil](https://community.bitwarden.com/u/littlephil)\
**Post date:** [February 23, 2022, 3:47pm UTC](https://community.bitwarden.com/t/setting-up-self-hosted-error-when-trying-to-register/38484/17 "2022-02-23T15:47:23Z")

</div>

Thanks, messaging them now. I hadnt realise that was an option. I thought the forum was it!!

P

---

<div class="post-metadata">

**Author:** ![Nail1684](https://sea1.discourse-cdn.com/flex001/user_avatar/community.bitwarden.com/nail1684/32/47626_2.png) [@Nail1684](https://community.bitwarden.com/u/Nail1684)\
**Post date:** [January 22, 2026, 11:37pm UTC](https://community.bitwarden.com/t/setting-up-self-hosted-error-when-trying-to-register/38484/18 "2026-01-22T23:37:25Z")

</div>

Closed on January 22, 2026, 11:37pm UTC


