NewRelic with Server and Laravel


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
## newrelic servers

Install

echo deb http://apt.newrelic.com/debian/ newrelic non-free >> /etc/apt/sources.list.d/newrelic.list

wget -O- https://download.newrelic.com/548C16BF.gpg | apt-key add -

apt-get update
apt-get install newrelic-sysmond

nrsysmond-config --set license_key=12XXXXXXXXXXXXXXXXXXXXXXX9c

/etc/init.d/newrelic-sysmond start

## newrelic application (PHP)

Make sure server already installed

apt-get install newrelic-php5

newrelic-install install

## server settings

Nginx

vim /etc/nginx/sites-enabled/default

location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;

# Add this
fastcgi_param PHP_VALUE "newrelic.appname=AppName";

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

Project

vim /path/to/laravel/project/bootstrap/start.php

if (extension_loaded('newrelic')) {
newrelic_set_appname('YOUR APP NAME');
}

Restart

service nginx restart
service php5-fpm restart

## Reference

- http://laravelista.com/how-to-install-new-relic-monitoring/