Ditutorial kali ini kita akan menginstall Nginx, PHP dan MySQL di Debian 8 (Jessie).

Upgrade system

apt-get update; apt-get upgrade -y

Install PHP

apt-get install php5 php5-cli php5-json php5-fpm php5-mysqlnd

buka file /etc/php5/fpm/php.ini cari baris

;cgi.fix_pathinfo=1

ubah menjadi

cgi.fix_pathinfo=0

buka file /etc/php5/fpm/pool.d/www.conf, ubah bagian

user = nginx
group = nginx
listen.owner = nginx
listen.group = nginx
;listen.mode = 0660
;listen = 127.0.0.1:9000

menjadi

user = www-data
group = www-data
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
listen = /var/run/php5-fpm.sock

Install MySQL

apt-get install mysql-server

password root mysql
buat password untuk user root MySQL.

untuk kedepannya, agar user anda otomatis login ke MySQL buat file baru di ~/.my.cnf yang isinya

[client]
user=root
password=PASSWORD

ganti PASSWORD dengan password yang tadi anda buat.

Install Nginx

Tambahkan source baru dibagian paling bawah /etc/apt/sources.list

deb http://nginx.org/packages/mainline/debian/ jessie nginx

Install signing key Nginx

wget http://nginx.org/keys/nginx_signing.key
apt-key add nginx_signing.key

terakhir install nginx

apt-get update; apt-get install nginx

Buka file /etc/nginx/nginx.conf ubah user nginx; jadi user www-data;
Agar Nginx mengenali file .php, buka file /etc/nginx/conf.d/default.conf tambahkan

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

Leave a comment

Your email address will not be published. Required fields are marked *