{"id":3823,"date":"2023-11-22T14:49:22","date_gmt":"2023-11-22T06:49:22","guid":{"rendered":"https:\/\/www.servergigabit.com\/guide\/?post_type=kb&#038;p=3823"},"modified":"2025-12-26T15:49:23","modified_gmt":"2025-12-26T07:49:23","slug":"self-hosting-bitwarden-on-a-vps-a-comprehensive-guide","status":"publish","type":"kb","link":"https:\/\/www.servergigabit.com\/guide\/kb\/self-hosting-bitwarden-on-a-vps-a-comprehensive-guide","title":{"rendered":"Self-hosting Bitwarden on a VPS: A Comprehensive Guide"},"content":{"rendered":"<p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone wp-image-3824\" src=\"https:\/\/www.servergigabit.com\/guide\/wp-content\/uploads\/2023\/11\/aaaa-300x169.jpeg\" alt=\"\" width=\"680\" height=\"383\" srcset=\"https:\/\/www.servergigabit.com\/guide\/wp-content\/uploads\/2023\/11\/aaaa-300x169.jpeg 300w, https:\/\/www.servergigabit.com\/guide\/wp-content\/uploads\/2023\/11\/aaaa-1024x576.jpeg 1024w, https:\/\/www.servergigabit.com\/guide\/wp-content\/uploads\/2023\/11\/aaaa-768x432.jpeg 768w, https:\/\/www.servergigabit.com\/guide\/wp-content\/uploads\/2023\/11\/aaaa-1536x864.jpeg 1536w, https:\/\/www.servergigabit.com\/guide\/wp-content\/uploads\/2023\/11\/aaaa-2048x1152.jpeg 2048w, https:\/\/www.servergigabit.com\/guide\/wp-content\/uploads\/2023\/11\/aaaa-370x208.jpeg 370w, https:\/\/www.servergigabit.com\/guide\/wp-content\/uploads\/2023\/11\/aaaa-1230x692.jpeg 1230w, https:\/\/www.servergigabit.com\/guide\/wp-content\/uploads\/2023\/11\/aaaa-800x450.jpeg 800w, https:\/\/www.servergigabit.com\/guide\/wp-content\/uploads\/2023\/11\/aaaa-390x219.jpeg 390w\" sizes=\"(max-width: 680px) 100vw, 680px\" \/><\/p>\n<div class=\"markdown markdown-main-panel\" dir=\"ltr\">\n<p data-sourcepos=\"7:1-7:283\">Bitwarden is a popular password manager that can be used to store and manage passwords securely. It is available as a hosted service, but it can also be self-hosted on a <a href=\"https:\/\/servergigabit.com\/\">VPS<\/a>. Self-hosting Bitwarden gives you more control over your data and can be more cost-effective in the long run.<\/p>\n<h2 data-sourcepos=\"9:1-9:16\"><strong>Requirements<\/strong><\/h2>\n<p data-sourcepos=\"11:1-11:52\">To self-host Bitwarden, you will need the following:<\/p>\n<ul data-sourcepos=\"13:1-16:0\">\n<li data-sourcepos=\"13:1-13:40\">A\u00a0<a href=\"https:\/\/www.servergigabit.com\/linux-vps-hosting\/\">Linux<\/a> operating system-based server.<\/li>\n<li data-sourcepos=\"14:1-14:28\">Root access to the server.<\/li>\n<li data-sourcepos=\"15:1-16:0\">A subdomain connected to the server.<\/li>\n<\/ul>\n<h2 data-sourcepos=\"17:1-17:44\"><strong>Installing Bitwarden Server (Standalone)<\/strong><\/h2>\n<p data-sourcepos=\"19:1-19:145\">The standalone version of Bitwarden is the easiest to install. It is a single Docker container that can be installed and run on any Linux system.<\/p>\n<h4 data-sourcepos=\"21:1-21:35\"><strong>Step 1: Install Docker and cURL<\/strong><\/h4>\n<p data-sourcepos=\"23:1-23:114\">Before you can install Bitwarden, you need to install <a href=\"https:\/\/contabo.com\/blog\/the-ultimate-guide-to-docker-installation-and-deployment-using-cloud-init\/\" target=\"_blank\" rel=\"noopener\">Docker<\/a> and cURL. You can do this with the following command:<\/p>\n<div class=\"code-block ng-star-inserted\">\n<pre><code class=\"code-container no-decoration-radius\" role=\"text\">apt install docker.io docker-compose curl -y\r\n<\/code><\/pre>\n<\/div>\n<h4 data-sourcepos=\"29:1-29:44\"><strong>Step 2: Download the Installation Script<\/strong><\/h4>\n<p data-sourcepos=\"31:1-31:105\">Next, you need to download the Bitwarden installation script. You can do this with the following command:<\/p>\n<div class=\"code-block ng-star-inserted\">\n<pre><code class=\"code-container no-decoration-radius\" role=\"text\">curl -s -o bitwarden.sh \\\u00a0\u00a0\r\n\r\nhttps:\/\/raw.githubusercontent.com\/bitwarden\/server\/master\/scripts\/bitwarden.sh \\\u00a0\u00a0\r\n\r\n&amp;&amp; chmod +x bitwarden.sh\r\n<\/code><\/pre>\n<\/div>\n<h4 data-sourcepos=\"41:1-41:39\"><strong>Step 3: Run the Installation Script<\/strong><\/h4>\n<p data-sourcepos=\"43:1-43:92\">Once you have downloaded the installation script, you can run it with the following command:<\/p>\n<div class=\"code-block ng-star-inserted\">\n<pre><code class=\"code-container no-decoration-radius\" role=\"text\">.\/bitwarden.sh install\r\n<\/code><\/pre>\n<\/div>\n<h4 data-sourcepos=\"49:1-49:47\"><strong>Step 3A: Install SSL Certificate (optional)<\/strong><\/h4>\n<p data-sourcepos=\"51:1-51:217\">It is recommended to install an SSL certificate for your Bitwarden instance. This will encrypt all traffic between your browser and your Bitwarden server. You can install an SSL certificate with the following command:<\/p>\n<div class=\"code-block ng-star-inserted\">\n<pre><code class=\"code-container no-decoration-radius\" role=\"text\">.\/bitwarden.sh install-cert\r\n<\/code><\/pre>\n<\/div>\n<h4 data-sourcepos=\"57:1-57:53\"><strong><span class=\"citation-0\">Step 3B: Getting an Installation ID and Key<\/span><\/strong><\/h4>\n<p data-sourcepos=\"59:1-60:84\"><span class=\"citation-0 citation-end-0\">Enter the email address that you&#8217;d like to be admin to get your ID and Key. You&#8217;ll then enter your <a href=\"https:\/\/bitwarden.com\/host\/\" target=\"_blank\" rel=\"noopener\">Installation ID and Installation Key<\/a> into the console.<\/span><\/p>\n<p>The console will prompt you for your ID first:\u00a0<picture><source srcset=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2022\/09\/image-1.png.webp 742w, https:\/\/contabo.com\/blog\/wp-content\/uploads\/2022\/09\/image-1-600x72.png.webp 600w\" type=\"image\/webp\" sizes=\"(max-width: 742px) 100vw, 742px\" \/><img decoding=\"async\" class=\"wp-image-14253 webpexpress-processed\" src=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2022\/09\/image-1.png\" sizes=\"(max-width: 742px) 100vw, 742px\" srcset=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2022\/09\/image-1.png 742w, https:\/\/contabo.com\/blog\/wp-content\/uploads\/2022\/09\/image-1-600x72.png 600w\" alt=\"\" width=\"742\" height=\"89\" \/><\/picture>\n<figure class=\"wp-block-image size-full\">Then your Key:<\/figure>\n<figure class=\"wp-block-image size-full\"><picture><source srcset=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2022\/09\/installation_key.png.webp 750w, https:\/\/contabo.com\/blog\/wp-content\/uploads\/2022\/09\/installation_key-600x50.png.webp 600w\" type=\"image\/webp\" sizes=\"(max-width: 750px) 100vw, 750px\" \/><img decoding=\"async\" class=\"wp-image-14465 webpexpress-processed\" src=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2022\/09\/installation_key.png\" sizes=\"(max-width: 750px) 100vw, 750px\" srcset=\"https:\/\/contabo.com\/blog\/wp-content\/uploads\/2022\/09\/installation_key.png 750w, https:\/\/contabo.com\/blog\/wp-content\/uploads\/2022\/09\/installation_key-600x50.png 600w\" alt=\"installation key\" width=\"750\" height=\"63\" \/><\/picture><\/figure>\n<h4 data-sourcepos=\"62:1-62:29\"><strong>Step 4: Create an Account<\/strong><\/h4>\n<p data-sourcepos=\"64:1-64:188\">Once the installation script has finished running, you can create an account on your Bitwarden instance. You can do this by going to your subdomain in your browser and creating an account.<\/p>\n<h2 data-sourcepos=\"66:1-66:45\"><strong>Installing Vaultwarden Server (Bitwarden)<\/strong><\/h2>\n<p data-sourcepos=\"68:1-68:185\">Vaultwarden is an unofficial Bitwarden-compatible server that can be used to self-host Bitwarden. It is written in Rust and is more lightweight than the standalone version of Bitwarden.<\/p>\n<h4 data-sourcepos=\"70:1-70:51\"><strong>Step 1: Install Docker and Other Needed Programs<\/strong><\/h4>\n<p data-sourcepos=\"72:1-72:136\">Before you can install Vaultwarden, you need to install Docker and other necessary programs. You can do this with the following command:<\/p>\n<div class=\"code-block ng-star-inserted\">\n<pre><code class=\"code-container no-decoration-radius\" role=\"text\">apt install apache2 docker.io docker-compose curl git wget sudo certbot python3-certbot-apache -y\r\n<\/code><\/pre>\n<\/div>\n<h4 data-sourcepos=\"78:1-78:33\"><strong>Step 2: Create a Virtual Host<\/strong><\/h4>\n<p data-sourcepos=\"80:1-80:149\">To tell the web server which port Vaultwarden is running on, you first need to insert a Virtual Host. You can create this with the following command:<\/p>\n<div class=\"code-block ng-star-inserted\">\n<pre><code class=\"code-container no-decoration-radius\" role=\"text\">nano \/etc\/apache2\/sites-available\/bitwarden.conf\r\n<\/code><\/pre>\n<\/div>\n<p data-sourcepos=\"86:1-86:35\">And paste in the following content:<\/p>\n<div class=\"code-block ng-star-inserted\">\n<pre><code class=\"code-container no-decoration-radius\" role=\"text\">&lt;VirtualHost *:80&gt;\r\n\r\n    ServerName &lt;Your(Sub)Domain&gt;\r\n\r\n    ProxyPreserveHost On\r\n\r\n    &lt;Proxy *&gt;\r\n\r\n        Order allow,deny\r\n\r\n        Allow from all\r\n\r\n    &lt;\/Proxy&gt;\r\n\r\n    ProxyPass \/ http:\/\/localhost:8081\/\r\n\r\n    ProxyPassReverse \/ http:\/\/localhost:8081\/\r\n\r\n&lt;\/VirtualHost&gt;\r\n<\/code><\/pre>\n<\/div>\n<h4 data-sourcepos=\"110:1-110:41\"><strong>Step 3: Activate the Required Modules<\/strong><\/h4>\n<p data-sourcepos=\"112:1-112:92\">Enable required modules with this command (the server needs these modules to work properly):<\/p>\n<div class=\"code-block ng-star-inserted\">\n<pre><code class=\"code-container no-decoration-radius\" role=\"text\">a2enmod ssl proxy proxy_http proxy_balancer lbmethod_byrequest\r\n<\/code><\/pre>\n<\/div>\n<p data-sourcepos=\"118:1-118:125\">You&#8217;ll need to restart the server afterward in order for the changes to take effect. Use this command to restart your server:<\/p>\n<div class=\"code-block ng-star-inserted\">\n<pre><code class=\"code-container no-decoration-radius\" role=\"text\">systemctl restart apache2\r\n<\/code><\/pre>\n<\/div>\n<h4 data-sourcepos=\"124:1-124:35\"><strong>Step 4: Install SSL certificate<\/strong><\/h4>\n<p data-sourcepos=\"126:1-126:78\">Unlike the first variant, you&#8217;ll need to manually install the SSL certificate.<\/p>\n<p data-sourcepos=\"128:1-128:106\">Fortunately, it&#8217;s a simple step. All you need to start the certification process is enter in this command:<\/p>\n<div class=\"code-block ng-star-inserted\">\n<pre><code class=\"code-container no-decoration-radius\" role=\"text\">certbot --apache\r\n<\/code><\/pre>\n<\/div>\n<p data-sourcepos=\"134:1-134:95\">The rest of the SSL certification process is straightforward, so we won\u2019t go into details here.<\/p>\n<h4 data-sourcepos=\"136:1-136:52\"><strong>Step 5 (Last Step): Download and Run Vaultwarden<\/strong><\/h4>\n<p data-sourcepos=\"138:1-138:98\">After all the preparations are complete, you can download the Vaultwarden image with this command:<\/p>\n<div class=\"code-block ng-star-inserted\">\n<pre><code class=\"code-container no-decoration-radius\" role=\"text\">docker pull vaultwarden\/server:latest\r\n<\/code><\/pre>\n<\/div>\n<p data-sourcepos=\"7:1-7:47\">And then start the container with this command:<\/p>\n<div class=\"code-block ng-star-inserted\">\n<pre><code class=\"code-container no-decoration-radius\" role=\"text\">docker run -d --name vaultwarden -v \/vw-data\/:\/data\/ -p 8081:80 vaultwarden\/server:latest\r\n<\/code><\/pre>\n<\/div>\n<p data-sourcepos=\"13:1-13:71\">Now, go to your (sub)domain in the browser and create an account there.<\/p>\n<p data-sourcepos=\"15:1-15:157\">Once you&#8217;ve created an account, your Vaultwarden (or Bitwarden instance) install is complete and ready to use. Thanks for following with us on this tutorial!<\/p>\n<h2 data-sourcepos=\"17:1-17:14\"><strong>Conclusion<\/strong><\/h2>\n<p data-sourcepos=\"19:1-19:233\">Self-hosting Bitwarden is a great way to take control of your password management. It is easy to do and can be done on any <a href=\"https:\/\/www.servergigabit.com\/linux-vps-hosting\/\">Linux VPS<\/a>. With the help of this tutorial, you can have your own Bitwarden instance up and running in no time.<\/p>\n<h4 data-sourcepos=\"21:1-21:20\"><strong>Additional Notes<\/strong><\/h4>\n<ul data-sourcepos=\"23:1-28:0\">\n<li data-sourcepos=\"23:1-24:0\">\n<p data-sourcepos=\"23:3-23:203\">If you are running Bitwarden on a low-powered VPS, you may want to consider using the Vaultwarden version instead of the standalone version. Vaultwarden is more lightweight and will use less resources.<\/p>\n<\/li>\n<li data-sourcepos=\"25:1-26:0\">\n<p data-sourcepos=\"25:3-25:200\">You can also use a reverse proxy like Nginx or Apache to proxy requests to your Bitwarden instance. This can add an extra layer of security and make it easier to manage multiple Bitwarden instances.<\/p>\n<\/li>\n<li data-sourcepos=\"27:1-28:0\">\n<p data-sourcepos=\"27:3-27:102\">If you are using a VPS with a firewall, you will need to open port 8081 for your Bitwarden instance.<\/p>\n<\/li>\n<\/ul>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Bitwarden is a popular password manager that can be used to store and manage passwords securely. It is available as a hosted service, but it can also be self-hosted on a VPS. Self-hosting Bitwarden gives you more control over your data and can be more cost-effective in the long run. Requirements To self-host Bitwarden, you will need the following: A\u00a0Linux&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"kbtopic":[1099],"kbtag":[1156,1155],"class_list":["post-3823","kb","type-kb","status-publish","hentry","kbtopic-tutorials","kbtag-bitwarden","kbtag-self-hosting-bitwarden"],"_links":{"self":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb\/3823","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb"}],"about":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/types\/kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/comments?post=3823"}],"version-history":[{"count":1,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb\/3823\/revisions"}],"predecessor-version":[{"id":3825,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb\/3823\/revisions\/3825"}],"wp:attachment":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/media?parent=3823"}],"wp:term":[{"taxonomy":"kbtopic","embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kbtopic?post=3823"},{"taxonomy":"kbtag","embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kbtag?post=3823"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}