HTTPS nginx configuration


I’m trying to set up Bitwarden on existing nginx server. Connection through HTTP is ok. But on HTTPS i’m getting ERR_CONNECTION_REFUSED. What’s wrong with my confs?

What i’ve changed from default configuration:
1.Changed http and https ports in config.yml file.
2.Turned off ssl in config.yml because nginx with ssl already exists.
3. Added two server blocks to nginx configuration file.(see below).

Thanks for help.

server {
    listen 443 ssl;

    ssl_certificate /root/; # use fullchain.cer for complete certificate;
    ssl_certificate_key /root/; # keep this private as much as possible;

    location / {
        proxy_pass http://localhost:44399/;

server {
    if ($host = {
        return 301 https://$host$request_uri;

    listen 80;
    listen [::]:80;

    return 404; # managed by Certbot

And config.yml changes

# Docker compose file port mapping for HTTP. Leave empty to remove the port mapping.
# Learn more:
http_port: 999
# Docker compose file port mapping for HTTPS. Leave empty to remove the port mapping.
# Learn more:
https_port: 44399
# Docker compose file version. Leave empty for default.
# Learn more:
# Configure Nginx for Captcha.
captcha: false
# Configure Nginx for SSL.
ssl: false

Hi @POLPAKETA94 - welcome to the community forums! And I am very sorry to hear about your issues installing Bitwarden server.

Can you tell us which version of BW server you are trying to install as well as which install script you are using? Also, what kind of device are you installing to (e.g., Windows PC, Linux PC, etc.). With a bit more information, perhaps someone here can help. Cheers!

I’ve installed Bitwarden according this manual
OS: Ubuntu 20.04

This is redirecting to the HTTPS port of Bitwarden, but you disabled SSL.

Since your nginx proxy is taking care of SSL, you can simply locally route the traffic to Bitwarden via HTTP, in your case to port 999.

Make sure to either block port 999 from external access with a firewall, or to bind it to localhost only, e.g. http_port:

Changing the port helped solve the problem. Thanks a lot.

1 Like