Certbot problem while setup on existing server


I have setup Bitwarden server on My small server, nothing fancy, but it holds (almost) all of My cloud stuff. As I used My existing server I have problems whit Certbot. I was hosting other services and pages before Bitwarden and I had already setup Certbot. Bitwarden comes whit Certbot integrated in docker and that is causing problems… I cant use two Certbot instances as bot require port 443 to be open for it, it creates conflicts. I have tried to use manually in some way, but whit out success. In ideal conclusion I have My existing Certbot running and generating, renewing also Bitwarden certificate whit out Certbot running on Docker.

Can anyone have suggestions how to setup in this way?

i made these modification to the run.sh scrip

grep -in certbot bwdata/scripts/run.sh 
87:            docker pull certbot/certbot
88:            docker run -it --rm --name certbot -p 8080:80 -v $OUTPUT_DIR/letsencrypt:/etc/letsencrypt/ certbot/certbot \
132:        docker pull certbot/certbot
133:        docker run -i --rm --name certbot -p 8443:443 -p 8080:80 \
134:            -v $OUTPUT_DIR/letsencrypt:/etc/letsencrypt/ certbot/certbot \

which allow me to run certbot on port 8080 for http and 8443 for https.

1 Like

Brilliant, seems to be working, tnx.

I still have issues. When I try to update Bitwarden I got "“Error starting userland proxy: listen tcp listen: address already in use.” error in docker.

And how save are there port change modifications? They will stay after update or I will need to reapply on every update?

Edit: Got it, update replaces run.sh script and that’s why it fails to start again.

I just replaced ports as shown and it runs. Those edits are wiped after update but take a notice of it and Your fine.

Had the same problem on my Synology NAS. Thank you for posting your solutions. They were really helpful.

For anyone still struggling with the issue and finding this post, here’s a little script I am running from a scheduled task to keep my bitwarden up to date and fix the ports automatically:


export bwdir=/path/to/bitwarden/bitwarden # set this to the bitwarden directory inside your bitwarden installation
export script=bwdata/scripts/run.sh
export timestamp=$(date +%Y%m%d_%H%M)

cd $bwdir
echo "####### bitwarden.sh updateself =>"
./bitwarden.sh updateself
echo "####### ./bitwarden.sh update =>"
./bitwarden.sh update

# Create a backup copy of run.sh and then replace the ports
# I am using 3443 and 3080. Adapt according to your port mapping. 
sed -i.ORIG_$timestamp "s/p 443:443/p 3443:443/" $script && \
  sed -i "s/p 80:80/p 3080:80/" $script

./bitwarden.sh start

Note: you’ll have to clean up old backup copies occasionally.