· 9 years ago · Mar 07, 2017, 12:58 AM
1#user nobody;
2worker_processes 1;
3
4#error_log logs/error.log;
5#error_log logs/error.log notice;
6#error_log logs/error.log info;
7
8#pid logs/nginx.pid;
9
10
11events {
12 worker_connections 1024;
13}
14
15
16http {
17 include mime.types;
18 default_type application/octet-stream;
19
20 #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
21 # '$status $body_bytes_sent "$http_referer" '
22 # '"$http_user_agent" "$http_x_forwarded_for"';
23
24 #access_log logs/access.log main;
25
26 sendfile on;
27 #tcp_nopush on;
28
29 #keepalive_timeout 0;
30 keepalive_timeout 65;
31
32 #gzip on;
33
34 server {
35 listen 80;
36 server_name localhost;
37
38 #charset koi8-r;
39
40 #access_log logs/host.access.log main;
41
42 location / {
43 root /usr/share/nginx/www;
44 index index.html index.htm;
45 }
46
47 location /grafana/ {
48 proxy_pass http://localhost:8080/;
49 }
50
51 #error_page 404 /404.html;
52
53 # redirect server error pages to the static page /50x.html
54 #
55 error_page 500 502 503 504 /50x.html;
56 location = /50x.html {
57 root html;
58 }
59
60 # proxy the PHP scripts to Apache listening on 127.0.0.1:80
61 #
62 #location ~ .php$ {
63 # proxy_pass http://127.0.0.1;
64 #}
65
66 # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
67 #
68 #location ~ .php$ {
69 # root html;
70 # fastcgi_pass 127.0.0.1:9000;
71 # fastcgi_index index.php;
72 # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
73 # include fastcgi_params;
74 #}
75
76 # deny access to .htaccess files, if Apache's document root
77 # concurs with nginx's one
78 #
79 #location ~ /.ht {
80 # deny all;
81 #}
82 }
83
84
85 # another virtual host using mix of IP-, name-, and port-based configuration
86 #
87 #server {
88 # listen 8000;
89 # listen somename:8080;
90 # server_name somename alias another.alias;
91
92 # location / {
93 # root html;
94 # index index.html index.htm;
95 # }
96 #}
97
98
99 # HTTPS server
100 #
101 #server {
102 # listen 443 ssl;
103 # server_name localhost;
104
105 # ssl_certificate cert.pem;
106 # ssl_certificate_key cert.key;
107
108 # ssl_session_cache shared:SSL:1m;
109 # ssl_session_timeout 5m;
110
111 # ssl_ciphers HIGH:!aNULL:!MD5;
112 # ssl_prefer_server_ciphers on;
113
114 # location / {
115 # root html;
116 # index index.html index.htm;
117 # }
118 #}
119
120}
121
122##################### Grafana Configuration Example #####################
123#
124# Everything has defaults so you only need to uncomment things you want to
125# change
126
127# possible values : production, development
128; app_mode = production
129
130# instance name, defaults to HOSTNAME environment variable value or hostname if HOSTNAME var is empty
131; instance_name = ${HOSTNAME}
132
133#################################### Paths ####################################
134[paths]
135# Path to where grafana can store temp files, sessions, and the sqlite3 db (if that is used)
136#
137;data = /var/lib/grafana
138#
139# Directory where grafana can store logs
140#
141;logs = /var/log/grafana
142#
143# Directory where grafana will automatically scan and look for plugins
144#
145;plugins = /var/lib/grafana/plugins
146
147#
148#################################### Server ####################################
149[server]
150# Protocol (http or https)
151protocol = http
152
153# The ip address to bind to, empty will bind to all interfaces
154;http_addr =
155
156# The http port to use
157http_port = 8080
158
159# The public facing domain name used to access grafana from a browser
160;domain = foo.bar
161
162# Redirect to correct domain if host header does not match domain
163# Prevents DNS rebinding attacks
164;enforce_domain = false
165
166# The full public facing url you use in browser, used for redirects and emails
167# If you use reverse proxy and sub path specify full url (with sub path)
168;root_url = %(protocol)s://%domain)s:/grafana
169
170# Log web requests
171;router_logging = false
172
173# the path relative working path
174;static_root_path = public
175
176# enable gzip
177;enable_gzip = false
178
179# https certs & key file
180;cert_file =
181;cert_key =
182
183#################################### Database ####################################
184[database]
185# You can configure the database connection by specifying type, host, name, user and password
186# as seperate properties or as on string using the url propertie.
187
188# Either "mysql", "postgres" or "sqlite3", it's your choice
189;type = sqlite3
190;host = 127.0.0.1:3306
191;name = grafana
192;user = root
193# If the password contains # or ; you have to wrap it with trippel quotes. Ex """#password;"""
194;password =
195
196# Use either URL or the previous fields to configure the database
197# Example: mysql://user:secret@host:port/database
198;url =
199
200# For "postgres" only, either "disable", "require" or "verify-full"
201;ssl_mode = disable
202
203# For "sqlite3" only, path relative to data_path setting
204;path = grafana.db
205
206#################################### Session ####################################
207[session]
208# Either "memory", "file", "redis", "mysql", "postgres", default is "file"
209;provider = file
210
211# Provider config options
212# memory: not have any config yet
213# file: session dir path, is relative to grafana data_path
214# redis: config like redis server e.g. `addr=127.0.0.1:6379,pool_size=100,db=grafana`
215# mysql: go-sql-driver/mysql dsn config string, e.g. `user:password@tcp(127.0.0.1:3306)/database_name`
216# postgres: user=a password=b host=localhost port=5432 dbname=c sslmode=disable
217;provider_config = sessions
218
219# Session cookie name
220;cookie_name = grafana_sess
221
222# If you use session in https only, default is false
223;cookie_secure = false
224
225# Session life time, default is 86400
226;session_life_time = 86400
227
228#################################### Analytics ####################################
229[analytics]
230# Server reporting, sends usage counters to stats.grafana.org every 24 hours.
231# No ip addresses are being tracked, only simple counters to track
232# running instances, dashboard and error counts. It is very helpful to us.
233# Change this option to false to disable reporting.
234;reporting_enabled = true
235
236# Set to false to disable all checks to https://grafana.net
237# for new vesions (grafana itself and plugins), check is used
238# in some UI views to notify that grafana or plugin update exists
239# This option does not cause any auto updates, nor send any information
240# only a GET request to http://grafana.net to get latest versions
241;check_for_updates = true
242
243# Google Analytics universal tracking code, only enabled if you specify an id here
244;google_analytics_ua_id =
245
246#################################### Security ####################################
247[security]
248# default admin user, created on startup
249;admin_user = admin
250
251# default admin password, can be changed before first start of grafana, or in profile settings
252;admin_password = admin
253
254# used for signing
255;secret_key = SW2YcwTIb9zpOOhoPsMm
256
257# Auto-login remember days
258;login_remember_days = 7
259;cookie_username = grafana_user
260;cookie_remember_name = grafana_remember
261
262# disable gravatar profile images
263;disable_gravatar = false
264
265# data source proxy whitelist (ip_or_domain:port separated by spaces)
266;data_source_proxy_whitelist =
267
268[snapshots]
269# snapshot sharing options
270;external_enabled = true
271;external_snapshot_url = https://snapshots-origin.raintank.io
272;external_snapshot_name = Publish to snapshot.raintank.io
273
274# remove expired snapshot
275;snapshot_remove_expired = true
276
277# remove snapshots after 90 days
278;snapshot_TTL_days = 90
279
280#################################### Users ####################################
281[users]
282# disable user signup / registration
283;allow_sign_up = true
284
285# Allow non admin users to create organizations
286;allow_org_create = true
287
288# Set to true to automatically assign new users to the default organization (id 1)
289;auto_assign_org = true
290
291# Default role new users will be automatically assigned (if disabled above is set to true)
292;auto_assign_org_role = Viewer
293
294# Background text for the user field on the login page
295;login_hint = email or username
296
297# Default UI theme ("dark" or "light")
298;default_theme = dark
299
300[auth]
301# Set to true to disable (hide) the login form, useful if you use OAuth, defaults to false
302;disable_login_form = false
303
304#################################### Anonymous Auth ##########################
305[auth.anonymous]
306# enable anonymous access
307;enabled = false
308
309# specify organization name that should be used for unauthenticated users
310;org_name = Main Org.
311
312# specify role for unauthenticated users
313;org_role = Viewer
314
315#################################### Github Auth ##########################
316[auth.github]
317;enabled = false
318;allow_sign_up = true
319;client_id = some_id
320;client_secret = some_secret
321;scopes = user:email,read:org
322;auth_url = https://github.com/login/oauth/authorize
323;token_url = https://github.com/login/oauth/access_token
324;api_url = https://api.github.com/user
325;team_ids =
326;allowed_organizations =
327
328#################################### Google Auth ##########################
329[auth.google]
330;enabled = false
331;allow_sign_up = true
332;client_id = some_client_id
333;client_secret = some_client_secret
334;scopes = https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email
335;auth_url = https://accounts.google.com/o/oauth2/auth
336;token_url = https://accounts.google.com/o/oauth2/token
337;api_url = https://www.googleapis.com/oauth2/v1/userinfo
338;allowed_domains =
339
340#################################### Generic OAuth ##########################
341[auth.generic_oauth]
342;enabled = false
343;name = OAuth
344;allow_sign_up = true
345;client_id = some_id
346;client_secret = some_secret
347;scopes = user:email,read:org
348;auth_url = https://foo.bar/login/oauth/authorize
349;token_url = https://foo.bar/login/oauth/access_token
350;api_url = https://foo.bar/user
351;team_ids =
352;allowed_organizations =
353
354#################################### Grafana.net Auth ####################
355[auth.grafananet]
356;enabled = false
357;allow_sign_up = true
358;client_id = some_id
359;client_secret = some_secret
360;scopes = user:email
361;allowed_organizations =
362
363#################################### Auth Proxy ##########################
364[auth.proxy]
365enabled = true
366header_name = X-WEBAUTH-USER
367header_property = email
368auto_sign_up = true
369;ldap_sync_ttl = 60
370;whitelist = 192.168.1.1, 192.168.2.1
371
372#################################### Basic Auth ##########################
373[auth.basic]
374;enabled = true
375
376#################################### Auth LDAP ##########################
377[auth.ldap]
378;enabled = false
379;config_file = /etc/grafana/ldap.toml
380;allow_sign_up = true
381
382#################################### SMTP / Emailing ##########################
383[smtp]
384;enabled = false
385;host = localhost:25
386;user =
387;password =
388;cert_file =
389;key_file =
390;skip_verify = false
391;from_address = admin@grafana.localhost
392
393[emails]
394;welcome_email_on_sign_up = false
395
396#################################### Logging ##########################
397[log]
398# Either "console", "file", "syslog". Default is console and file
399# Use space to separate multiple modes, e.g. "console file"
400;mode = console file
401
402# Either "trace", "debug", "info", "warn", "error", "critical", default is "info"
403;level = info
404
405# optional settings to set different levels for specific loggers. Ex filters = sqlstore:debug
406;filters =
407
408
409# For "console" mode only
410[log.console]
411;level =
412
413# log line format, valid options are text, console and json
414;format = console
415
416# For "file" mode only
417[log.file]
418;level =
419
420# log line format, valid options are text, console and json
421;format = text
422
423# This enables automated log rotate(switch of following options), default is true
424;log_rotate = true
425
426# Max line number of single file, default is 1000000
427;max_lines = 1000000
428
429# Max size shift of single file, default is 28 means 1 << 28, 256MB
430;max_size_shift = 28
431
432# Segment log daily, default is true
433;daily_rotate = true
434
435# Expired days of log file(delete after max days), default is 7
436;max_days = 7
437
438[log.syslog]
439;level =
440
441# log line format, valid options are text, console and json
442;format = text
443
444# Syslog network type and address. This can be udp, tcp, or unix. If left blank, the default unix endpoints will be used.
445;network =
446;address =
447
448# Syslog facility. user, daemon and local0 through local7 are valid.
449;facility =
450
451# Syslog tag. By default, the process' argv[0] is used.
452;tag =
453
454
455#################################### AMQP Event Publisher ##########################
456[event_publisher]
457;enabled = false
458;rabbitmq_url = amqp://localhost/
459;exchange = grafana_events
460
461;#################################### Dashboard JSON files ##########################
462[dashboards.json]
463;enabled = false
464;path = /var/lib/grafana/dashboards
465
466#################################### Alerting ######################################
467[alerting]
468# Makes it possible to turn off alert rule execution.
469;execute_alerts = true
470
471#################################### Internal Grafana Metrics ##########################
472# Metrics available at HTTP API Url /api/metrics
473[metrics]
474# Disable / Enable internal metrics
475;enabled = true
476
477# Publish interval
478;interval_seconds = 10
479
480# Send internal metrics to Graphite
481[metrics.graphite]
482# Enable by setting the address setting (ex localhost:2003)
483;address =
484;prefix = prod.grafana.%(instance_name)s.
485
486#################################### Internal Grafana Metrics ##########################
487# Url used to to import dashboards directly from Grafana.net
488[grafana_net]
489;url = https://grafana.net
490
491#################################### External image storage ##########################
492[external_image_storage]
493# Used for uploading images to public servers so they can be included in slack/email messages.
494# you can choose between (s3, webdav)
495;provider =
496
497[external_image_storage.s3]
498;bucket_url =
499;access_key =
500;secret_key =
501
502[external_image_storage.webdav]
503;url =
504;username =
505;password =