|
2 | 2 | title: 'Self-Hosted Reverse Proxy'
|
3 | 3 | ---
|
4 | 4 |
|
5 |
| -Adding a reverse proxy in front of your Sentry deployment is strongly recommended for one big reason: you can fine tune every configuration to fit your current setup. A dedicated reverse proxy that does SSL/TLS termination that also forwards the client IP address as Docker Compose internal network (as this is [close to impossible to get otherwise)](https://github.com/getsentry/self-hosted/issues/554) would give you the best Sentry experience. |
| 5 | +Adding a reverse proxy in front of your Sentry deployment is strongly recommended for one big reason: you can fine tune every configuration to fit your current setup. A dedicated reverse proxy that does SSL/TLS termination that also forwards the client IP address as Docker Compose internal network (as this is [close to impossible to get otherwise](https://github.com/getsentry/self-hosted/issues/554)) would give you the best Sentry experience. |
6 | 6 |
|
7 | 7 | Once you have setup a reverse proxy to your Sentry instance, you should modify the `system.url-prefix` in the `config.yml` file to match your new URL and protocol. You should also update the SSL/TLS section in the `sentry/sentry.conf.py` script, otherwise you may get CSRF-related errors when performing certain actions such as configuring integrations.
|
8 | 8 |
|
@@ -36,15 +36,64 @@ Endpoint for health checks is available on `/_health/` endpoint using HTTP proto
|
36 | 36 |
|
37 | 37 | ## Reverse Proxy Examples
|
38 | 38 |
|
39 |
| -<!-- ### NGINX |
| 39 | +### NGINX |
40 | 40 |
|
41 |
| -Put some NGINX config here... Give link to tune NGINX. |
| 41 | +We recommend installing NGINX since that's what we are using on [sentry.io](https://sentry.io/). |
| 42 | + |
| 43 | +```nginx |
| 44 | +error_log /var/log/nginx/error.log warn; |
| 45 | +
|
| 46 | +# generated 2024-04-29, Mozilla Guideline v5.7, nginx 1.24.0, OpenSSL 3.0.13, modern configuration, no HSTS, no OCSP |
| 47 | +# https://ssl-config.mozilla.org/#server=nginx&version=1.24.0&config=modern&openssl=3.0.13&hsts=false&ocsp=false&guideline=5.7 |
| 48 | +server { |
| 49 | + listen 443 ssl http2; |
| 50 | + listen [::]:443 ssl http2; |
| 51 | +
|
| 52 | + ssl_certificate /etc/letsencrypt/live/sentry.yourcompany.com/fullchain.pem; |
| 53 | + ssl_certificate_key /etc/letsencrypt/live/sentry.yourcompany.com/privkey.pem; |
| 54 | + ssl_session_timeout 1d; |
| 55 | + ssl_session_cache shared:MozSSL:10m; # about 40000 sessions |
| 56 | + ssl_session_tickets off; |
| 57 | +
|
| 58 | + ssl_dhparam /etc/letsencrypt/ffdhe2048.txt; |
| 59 | +
|
| 60 | + # modern configuration |
| 61 | + ssl_protocols TLSv1.3; |
| 62 | + ssl_prefer_server_ciphers off; |
| 63 | +
|
| 64 | + proxy_buffering on; |
| 65 | + proxy_buffer_size 128k; |
| 66 | + proxy_buffers 4 256k; |
| 67 | +
|
| 68 | + location / { |
| 69 | + include proxy_params; |
| 70 | + proxy_pass http://your-sentry-ip:9000; |
| 71 | + } |
| 72 | +} |
| 73 | +
|
| 74 | +server { |
| 75 | + server_name sentry.yourcompany.com; |
| 76 | + listen 80; |
| 77 | + listen [::]:80; |
| 78 | +
|
| 79 | + root /var/www/html; |
| 80 | + # Allow certbot to do http-01 challenges |
| 81 | + location /.well-known/ { |
| 82 | + try_files $uri =404; |
| 83 | + } |
| 84 | + # otherwise redirect to HTTPS |
| 85 | + location / { |
| 86 | + return 301 https://$host$request_uri; |
| 87 | + } |
| 88 | +} |
| 89 | +``` |
| 90 | + |
| 91 | +To use NGINX with ACME server such as Let's Encrypt, refer to this [blog post by Nginx](https://www.nginx.com/blog/using-free-ssltls-certificates-from-lets-encrypt-with-nginx/). |
42 | 92 |
|
43 | 93 | It is also recommended to fine tune your NGINX for some performance benefits. You can refer to these blog posts from NGINX:
|
44 | 94 |
|
45 | 95 | - [Tuning NGINX for Performance - NGINX](https://www.nginx.com/blog/tuning-nginx/)
|
46 | 96 | - [Performance Tuning - Tips & Tricks - NGINX](https://www.nginx.com/blog/performance-tuning-tips-tricks/)
|
47 |
| ---> |
48 | 97 |
|
49 | 98 | ### Caddy
|
50 | 99 |
|
|
0 commit comments