mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Docs: Update behind_proxy.md to include HTTPS and URL rewrite example (#21832)
This commit is contained in:
parent
173375cb65
commit
b55a39a221
@ -37,10 +37,11 @@ domain = foo.bar
|
||||
|
||||
Nginx is a high performance load balancer, web server and reverse proxy: https://www.nginx.com/
|
||||
|
||||
#### Nginx configuration with HTTP and Reverse Proxy enabled
|
||||
```bash
|
||||
server {
|
||||
listen 80;
|
||||
root /usr/share/nginx/www;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
|
||||
location / {
|
||||
@ -49,6 +50,44 @@ server {
|
||||
}
|
||||
```
|
||||
|
||||
### Grafana configuration with hosting HTTPS in Nginx (ex https://foo.bar)
|
||||
|
||||
```bash
|
||||
[server]
|
||||
domain = foo.bar
|
||||
root_url = https://foo.bar
|
||||
```
|
||||
|
||||
#### Nginx configuration with HTTPS, Reverse Proxy, HTTP to HTTPS redirect and URL re-writes enabled
|
||||
|
||||
Instead of http://foo.bar:3000/?orgId=1, this configuration will redirect all HTTP requests to HTTPS and re-write the URL so that port 3000 isn't visible and will result in https://foo.bar/?orgId=1
|
||||
|
||||
```bash
|
||||
server {
|
||||
listen 80;
|
||||
server_name foo.bar;
|
||||
return 301 https://foo.bar$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
server_name foo.bar;
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
ssl_certificate /etc/nginx/certs/foo_bar.crt;
|
||||
ssl_certificate_key /etc/nginx/certs/foo_bar_decrypted.key;
|
||||
ssl_protocols TLSv1.2;
|
||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
|
||||
location / {
|
||||
rewrite /(.*) /$1 break;
|
||||
proxy_pass http://localhost:3000/;
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Examples with **sub path** (ex http://foo.bar/grafana)
|
||||
|
||||
#### Grafana configuration with sub path
|
||||
|
Loading…
Reference in New Issue
Block a user