Advertisement
deminart

vaultwarden.conf

Mar 12th, 2024 (edited)
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. # The `upstream` directives ensure that you have a http/1.1 connection
  2. # This enables the keepalive option and better performance
  3. #
  4. # Define the server IP and ports here.
  5. upstream vaultwarden-default {
  6. zone vaultwarden-default 64k;
  7. server 127.0.0.1:8088;
  8. keepalive 2;
  9. }
  10.  
  11. # Needed to support websocket connections
  12. # See: https://nginx.org/en/docs/http/websocket.html
  13. # Instead of "close" as stated in the above link we send an empty value.
  14. # Else all keepalive connections will not work.
  15. map $http_upgrade $connection_upgrade {
  16. default upgrade;
  17. '' "";
  18. }
  19.  
  20. # Redirect HTTP to HTTPS
  21. server {
  22. listen 80;
  23. listen [::]:80;
  24. # server_name pass.sam.host;
  25.  
  26. if ($host = pass.sam.host) {
  27. return 301 https://$host$request_uri;
  28. }
  29. return 404;
  30. }
  31.  
  32. server {
  33. # For older versions of nginx appened http2 to the listen line after ssl and remove `http2 on`
  34. listen 443 ssl;
  35. listen [::]:443 ssl;
  36. # http2 on;
  37. # server_name pass.sam.host;
  38.  
  39. # Specify SSL Config when needed
  40. ssl_certificate /etc/ssl/pass.sam.host/fullchain.pem;
  41. ssl_certificate_key /etc/ssl/pass.sam.host/privkey.pem;
  42.  
  43. client_max_body_size 525M;
  44. proxy_max_temp_file_size 0;
  45. location / {
  46. proxy_http_version 1.1;
  47. proxy_set_header Upgrade $http_upgrade;
  48. proxy_set_header Connection $connection_upgrade;
  49.  
  50. proxy_set_header Host $host;
  51. proxy_set_header X-Real-IP $remote_addr;
  52. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  53. proxy_set_header X-Forwarded-Proto $scheme;
  54.  
  55. proxy_pass http://172.26.8.203:8088/;
  56. }
  57.  
  58. # Optionally add extra authentication besides the ADMIN_TOKEN
  59. # Remove the comments below `#` and create the htpasswd_file to have it active
  60. #
  61. #location /admin {
  62. # # See: https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/
  63. # auth_basic "Private";
  64. # auth_basic_user_file /path/to/htpasswd_file;
  65. #
  66. # proxy_http_version 1.1;
  67. # proxy_set_header Upgrade $http_upgrade;
  68. # proxy_set_header Connection $connection_upgrade;
  69. #
  70. # proxy_set_header Host $host;
  71. # proxy_set_header X-Real-IP $remote_addr;
  72. # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  73. # proxy_set_header X-Forwarded-Proto $scheme;
  74. #
  75. # proxy_pass http://vaultwarden-default;
  76. #}
  77. }
  78.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement