Skip to content

Instantly share code, notes, and snippets.

@alexclear
Created July 10, 2014 06:34
Show Gist options
  • Save alexclear/43116658971c6e727098 to your computer and use it in GitHub Desktop.
Save alexclear/43116658971c6e727098 to your computer and use it in GitHub Desktop.
ElasticSearch and Graphite proxied by nginx
server {
listen {{ grafana_ext_ip }}:{{ grafana_http_port }}; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
root /usr/share/nginx/www/grafana/src;
index index.html index.htm;
auth_basic "Restricted";
auth_basic_user_file htpasswd.grafana;
# Make site accessible from http://localhost/
server_name {{ grafana_server_name }};
location / {
try_files $uri $uri/ /index.html;
}
location /graphite/ {
proxy_pass http://127.0.0.1:3080;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
client_max_body_size 10m;
proxy_connect_timeout 90;
proxy_send_timeout 180;
proxy_read_timeout 180;
}
location /elasticsearch/ {
proxy_pass http://127.0.0.1:19201;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
client_max_body_size 10m;
proxy_connect_timeout 90;
proxy_send_timeout 180;
proxy_read_timeout 180;
}
}
server {
listen 3080; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
root /usr/share/nginx/www/grafana/src;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name {{ grafana_server_name }};
error_log /var/log/nginx/graphite.log;
location / {
rewrite ^/graphite(.*)$ $1;
proxy_pass http://127.0.0.1:8000;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
client_max_body_size 10m;
proxy_connect_timeout 90;
proxy_send_timeout 180;
proxy_read_timeout 180;
}
}
server {
listen 19201; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
root /usr/share/nginx/www/grafana/src;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name {{ grafana_server_name }};
error_log /var/log/nginx/elasticsearch.log;
location / {
rewrite ^/elasticsearch(.*)$ $1;
proxy_pass http://127.0.0.1:19200;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
client_max_body_size 10m;
proxy_connect_timeout 90;
proxy_send_timeout 180;
proxy_read_timeout 180;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment