Updated nginx examples for v1.29.0
parent
e08ddf7e87
commit
51ac295a2b
|
@ -110,7 +110,7 @@ You'll have to set `IP_HEADER` to `X-Forwarded-For` instead of `X-Real-IP` in th
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>Nginx (by blackdex)</summary><br/>
|
<summary>Nginx - v1.29.0 (by blackdex)</summary><br/>
|
||||||
|
|
||||||
```nginx
|
```nginx
|
||||||
# The `upstream` directives ensure that you have a http/1.1 connection
|
# The `upstream` directives ensure that you have a http/1.1 connection
|
||||||
|
@ -122,10 +122,14 @@ upstream vaultwarden-default {
|
||||||
server 127.0.0.1:8080;
|
server 127.0.0.1:8080;
|
||||||
keepalive 2;
|
keepalive 2;
|
||||||
}
|
}
|
||||||
upstream vaultwarden-ws {
|
|
||||||
zone vaultwarden-ws 64k;
|
# Needed to support websocket connections
|
||||||
server 127.0.0.1:3012;
|
# See: https://nginx.org/en/docs/http/websocket.html
|
||||||
keepalive 2;
|
# Instead of "close" as stated in the above link we send an empty value.
|
||||||
|
# Else all keepalive connections will not work.
|
||||||
|
map $http_upgrade $connection_upgrade {
|
||||||
|
default upgrade;
|
||||||
|
'' "";
|
||||||
}
|
}
|
||||||
|
|
||||||
# Redirect HTTP to HTTPS
|
# Redirect HTTP to HTTPS
|
||||||
|
@ -133,7 +137,11 @@ server {
|
||||||
listen 80;
|
listen 80;
|
||||||
listen [::]:80;
|
listen [::]:80;
|
||||||
server_name vaultwarden.example.tld;
|
server_name vaultwarden.example.tld;
|
||||||
return 301 https://$host$request_uri;
|
|
||||||
|
if ($host = vaultwarden.example.tld) {
|
||||||
|
return 301 https://$host$request_uri;
|
||||||
|
}
|
||||||
|
return 404;
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
|
@ -146,11 +154,12 @@ server {
|
||||||
#ssl_certificate_key /path/to/certificate/letsencrypt/live/vaultwarden.example.tld/privkey.pem;
|
#ssl_certificate_key /path/to/certificate/letsencrypt/live/vaultwarden.example.tld/privkey.pem;
|
||||||
#ssl_trusted_certificate /path/to/certificate/letsencrypt/live/vaultwarden.example.tld/fullchain.pem;
|
#ssl_trusted_certificate /path/to/certificate/letsencrypt/live/vaultwarden.example.tld/fullchain.pem;
|
||||||
|
|
||||||
client_max_body_size 128M;
|
client_max_body_size 525M;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header "Connection" "";
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection $connection_upgrade;
|
||||||
|
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
@ -160,21 +169,6 @@ server {
|
||||||
proxy_pass http://vaultwarden-default;
|
proxy_pass http://vaultwarden-default;
|
||||||
}
|
}
|
||||||
|
|
||||||
# DO NOT add a trailing /, else you will experience issues
|
|
||||||
location /notifications/hub {
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection "upgrade";
|
|
||||||
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header Forwarded $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
|
|
||||||
proxy_pass http://vaultwarden-ws;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Optionally add extra authentication besides the ADMIN_TOKEN
|
# Optionally add extra authentication besides the ADMIN_TOKEN
|
||||||
# Remove the comments below `#` and create the htpasswd_file to have it active
|
# Remove the comments below `#` and create the htpasswd_file to have it active
|
||||||
#
|
#
|
||||||
|
@ -184,7 +178,8 @@ server {
|
||||||
# auth_basic_user_file /path/to/htpasswd_file;
|
# auth_basic_user_file /path/to/htpasswd_file;
|
||||||
#
|
#
|
||||||
# proxy_http_version 1.1;
|
# proxy_http_version 1.1;
|
||||||
# proxy_set_header "Connection" "";
|
# proxy_set_header Upgrade $http_upgrade;
|
||||||
|
# proxy_set_header Connection $connection_upgrade;
|
||||||
#
|
#
|
||||||
# proxy_set_header Host $host;
|
# proxy_set_header Host $host;
|
||||||
# proxy_set_header X-Real-IP $remote_addr;
|
# proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
@ -208,7 +203,7 @@ If you run into 504 Gateway Timeout problems, tell nginx to wait longer for vaul
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>Nginx with sub-path (by BlackDex)</summary><br/>
|
<summary>Nginx with sub-path - v1.29.0 (by BlackDex)</summary><br/>
|
||||||
|
|
||||||
In this example vaultwarden will be available via https://bitwarden.example.tld/vault/<br/>
|
In this example vaultwarden will be available via https://bitwarden.example.tld/vault/<br/>
|
||||||
If you want to use any other sub-path, like `bitwarden` or `secret-vault` you should change `/vault/` in the example below to match.<br/>
|
If you want to use any other sub-path, like `bitwarden` or `secret-vault` you should change `/vault/` in the example below to match.<br/>
|
||||||
|
@ -217,7 +212,7 @@ For this to work you need to configure your `DOMAIN` variable to match so it sho
|
||||||
|
|
||||||
```ini
|
```ini
|
||||||
; Add the sub-path! Else this will not work!
|
; Add the sub-path! Else this will not work!
|
||||||
DOMAIN=https://bitwarden.example.tld/vault/
|
DOMAIN=https://vaultwarden.example.tld/vault/
|
||||||
```
|
```
|
||||||
|
|
||||||
```nginx
|
```nginx
|
||||||
|
@ -230,28 +225,28 @@ upstream vaultwarden-default {
|
||||||
server 127.0.0.1:8080;
|
server 127.0.0.1:8080;
|
||||||
keepalive 2;
|
keepalive 2;
|
||||||
}
|
}
|
||||||
upstream vaultwarden-ws {
|
|
||||||
zone vaultwarden-ws 64k;
|
# Needed to support websocket connections
|
||||||
server 127.0.0.1:3012;
|
# See: https://nginx.org/en/docs/http/websocket.html
|
||||||
keepalive 2;
|
# Instead of "close" as stated in the above link we send an empty value.
|
||||||
|
# Else all keepalive connections will not work.
|
||||||
|
map $http_upgrade $connection_upgrade {
|
||||||
|
default upgrade;
|
||||||
|
'' "";
|
||||||
}
|
}
|
||||||
|
|
||||||
# Redirect HTTP to HTTPS
|
# Redirect HTTP to HTTPS
|
||||||
server {
|
server {
|
||||||
if ($host = bitwarden.example.tld) {
|
|
||||||
return 301 https://$host$request_uri;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
listen 80;
|
listen 80;
|
||||||
listen [::]:80;
|
listen [::]:80;
|
||||||
server_name bitwarden.example.tld;
|
server_name vaultwarden.example.tld;
|
||||||
|
|
||||||
|
if ($host = vaultwarden.example.tld) {
|
||||||
|
return 301 https://$host$request_uri;
|
||||||
|
}
|
||||||
return 404;
|
return 404;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 443 ssl http2;
|
listen 443 ssl http2;
|
||||||
listen [::]:443 ssl http2;
|
listen [::]:443 ssl http2;
|
||||||
|
@ -262,50 +257,23 @@ server {
|
||||||
#ssl_certificate_key /path/to/certificate/letsencrypt/live/vaultwarden.example.tld/privkey.pem;
|
#ssl_certificate_key /path/to/certificate/letsencrypt/live/vaultwarden.example.tld/privkey.pem;
|
||||||
#ssl_trusted_certificate /path/to/certificate/letsencrypt/live/vaultwarden.example.tld/fullchain.pem;
|
#ssl_trusted_certificate /path/to/certificate/letsencrypt/live/vaultwarden.example.tld/fullchain.pem;
|
||||||
|
|
||||||
client_max_body_size 128M;
|
client_max_body_size 525M;
|
||||||
|
|
||||||
## Using a Sub Path Config
|
## Using a Sub Path Config
|
||||||
# Path to the root of your installation
|
# Path to the root of your installation
|
||||||
# Be sure to DO ADD a trailing /, else you will experience issues
|
# Be sure to DO ADD a trailing /, else you will experience issues
|
||||||
# But only for this location, all other locations should NOT add this.
|
# But only for this location, all other locations should NOT add this.
|
||||||
location /vault/ {
|
location /vault/ {
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header "Connection" "";
|
|
||||||
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
|
|
||||||
proxy_pass http://vaultwarden-default;
|
|
||||||
}
|
|
||||||
|
|
||||||
# DO NOT add a trailing /, else you will experience issues
|
|
||||||
location /vault/notifications/hub/negotiate {
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header "Connection" "";
|
|
||||||
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
|
|
||||||
proxy_pass http://vaultwarden-default;
|
|
||||||
}
|
|
||||||
|
|
||||||
# DO NOT add a trailing /, else you will experience issues
|
|
||||||
location /vault/notifications/hub {
|
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Connection "upgrade";
|
proxy_set_header Connection $connection_upgrade;
|
||||||
|
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header Forwarded $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
|
||||||
proxy_pass http://vaultwarden-ws;
|
proxy_pass http://vaultwarden-default;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Optionally add extra authentication besides the ADMIN_TOKEN
|
# Optionally add extra authentication besides the ADMIN_TOKEN
|
||||||
|
@ -318,7 +286,8 @@ server {
|
||||||
# auth_basic_user_file /path/to/htpasswd_file;
|
# auth_basic_user_file /path/to/htpasswd_file;
|
||||||
#
|
#
|
||||||
# proxy_http_version 1.1;
|
# proxy_http_version 1.1;
|
||||||
# proxy_set_header "Connection" "";
|
# proxy_set_header Upgrade $http_upgrade;
|
||||||
|
# proxy_set_header Connection $connection_upgrade;
|
||||||
#
|
#
|
||||||
# proxy_set_header Host $host;
|
# proxy_set_header Host $host;
|
||||||
# proxy_set_header X-Real-IP $remote_addr;
|
# proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
|
Loading…
Reference in New Issue