Perintah install nginx
|
sudo apt-get install nginx
|
Jalankan serive nginx
Test di browser dengan mengakses http://localhost atau http://IP-ADDRESS
Konfigurasi virtual host, buka file /etc/nginx/sites-available/default
|
sudo nano /etc/nginx/sites-available/default
|
Cari baris
|
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
|
root : document root directory, biasanya kalau memakai Apache lokasinya di /var/www/
index : file yang menjadi index pada directory atau file yang pertama dibaca dalam directroy. tambahkan index.php
|
index index.php index.html index.htm;
|
style="display:block; text-align:center;"
data-ad-layout="in-article"
data-ad-format="fluid"
data-ad-client="ca-pub-4076542302080500"
data-ad-slot="3747100090">
(adsbygoogle = window.adsbygoogle || []).push({});
Selanjutnya untuk pembacaan file .php, cari baris location ~ .php. Lepas tanda komentar seperti pada kode dibawah ini.
1
2
3
4
5
6
7
8
9
10
11
12
|
location ~ .php$ {
try_files $uri =404; ---------> Tambahkan baris ini
fastcgi_split_path_info ^(.+.php)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
|
Uji coba konfigurasi nginx
Hasilnya
|
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
|
Restart nginx
|
sudo service nginx restart
|
Install PHP
|
sudo apt-get install php5 php5-fpm php5-mysql
|
Konfigurasi PHP, buka file php.ini
|
sudo nano /etc/php5/fpm/php.ini
|
Cari baris cgi.fix_pathinfo=1, lepas komentar dan ubah nilainya menjadi 0
Restart fpm service
|
sudo service php5-fpm restart
|
Uji coba file PHP
|
sudo nano /usr/share/nginx/html/test.php
|
style="display:block; text-align:center;"
data-ad-layout="in-article"
data-ad-format="fluid"
data-ad-client="ca-pub-4076542302080500"
data-ad-slot="3747100090">
(adsbygoogle = window.adsbygoogle || []).push({});
Masukkan kode phpinfo
Akses
http://localhost/test.php, hasilnya
Install MariaDB
|
sudo apt-get install mariadb-server mariadb-client
|
Masukkan password user root database
Ulangi password
Uji coba login ke MariaDB
|
mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 56
Server version: 5.5.41-MariaDB-1ubuntu0.14.04.1 (Ubuntu)
Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
MariaDB [(none)]>
|
Install phpMyAdmin
|
sudo apt-get install phpmyadmin
|
Pilih Yes
Pilih saja apache2, nanti dikonfigurasi agar terhubung ke nginx
Masukkan password database administrative user
Masukkan password untuk phpMyAdmin
Ulangi password
Buat link agar terhubung ke folder nginx
|
sudo ln -s /usr/share/phpmyadmin/ /usr/share/nginx/html
|
Uji coba masuk ke phpMyadmin,
http://localhost/phpmyadmin
selamat mencoba