Advertisement
ElfenSky

bitwarden nginx

Apr 15th, 2021
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 1.45 KB | None | 0 0
  1. # redirect http to https
  2. server {
  3.     listen 80;
  4.     listen [::]:80;
  5.     server_name sub.domain.com;
  6.     return 301 https://sub.domain.com$request_uri;
  7. }
  8.  
  9. # actually handle the requests
  10. server {
  11.     listen 443 ssl http2;
  12.     listen [::]:443 ssl http2;
  13.     server_name sub.domain.com;
  14.  
  15.     #HTTP_TO_HTTPS_END
  16.     ssl_certificate    /path/to/cert.pem;
  17.     ssl_certificate_key    /path/to/key.pem;
  18.     #SSL-END
  19.  
  20.     #HSTS
  21.     add_header Strict-Transport-Security "max-age=31536000; preload";
  22.  
  23.     #BITWARDEN SPECIFIC
  24.     client_max_body_size 128M;
  25.    
  26.     #Had to add this for diagnostics to work, otherwise I got 504 timeout
  27.     proxy_read_timeout 300;
  28.     proxy_connect_timeout 300;
  29.     proxy_send_timeout 300;
  30.    
  31.     #this is from the wiki
  32.     location / {
  33.         proxy_pass http://127.0.0.1:9002;
  34.         proxy_set_header Host $host;
  35.         proxy_set_header X-Real-IP $remote_addr;
  36.         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  37.         proxy_set_header X-Forwarded-Proto $scheme;
  38.     }
  39.    
  40.     location /notifications/hub {
  41.         proxy_pass http://127.0.0.1:9003;
  42.         proxy_set_header Upgrade $http_upgrade;
  43.         proxy_set_header Connection "upgrade";
  44.      }
  45.    
  46.     location /notifications/hub/negotiate {
  47.         proxy_pass http://127.0.0.1:9002;
  48.     }
  49.  
  50.     # used by the panel to request and verify letsencrypt certs
  51.     location ~ \.well-known{
  52.         allow all;
  53.     }
  54.    
  55.     #nginx log
  56.     access_log  /www/wwwlogs/bitwarden.lavrenov.io.log;
  57.     error_log  /www/wwwlogs/bitwarden.lavrenov.io.error.log;
  58. }
  59.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement