Thursday, September 24, 2015

Install Linux Nginx MySQL PHP (LEMP) di Ubuntu 14.04

Linux Nginx MYSQL PHP (LEMP) tidak jauh berbeda degan LAMP Linux Apsche MYSQL PHP , yaitu sekelompok perangkat lunak open source yang befungsi untuk menjalakn sebuah website dinamis ( web yang dapat melakukan interaksi dengan pengunjung).  Dalam hal ini , antara LEMP dan LAMP hanya berbeda pada webserver nya yaitu Enginx  (Engin X) pada LEMP dan Apache pada LAMP   .

Ok berikut tahapan untuk menginstall LEMP di ubuntu server 14.04:

1.    Isntall Nginx  ,   sebelum nya pastikan tidak ada web server lain yang berjalan dengan port yang sama di server kita, jika anda sudah menginstall apache anda bisa merubah port nya atau meng hapus nya

root@ubuntu:~# apt-get purge apache2*
root@ubuntu:~# apt-get autoremove -y


*.    install Nginx




root@ubuntu:~# apt-get install nginx

 



- setelah prose selesai start nginx




root@ubuntu:~# service nginx start


- test nginx apakah sudah berhasil anda install dengan benar atau belum silahkan   masukan IPVPS atau domainanda.com ke dalam browser anda. Jika anda mendapatkan  tampilan selamat datang di nginx, berarti proses instalasi nginx anda berhasil, root folder Nginx ada di /usr/share/nginx/html/




Selection_059



*.    Konfigurasi Nginx di file  /etc/nginx/nginx.conf , Aturlah worker_processes tergantung berapa CPU yang terdapat dalam server anda.




root@ubuntu:~# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 1
On-line CPU(s) list: 0
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 15
Model: 6
Stepping: 1
CPU MHz: 2133.408
BogoMIPS: 4266.81
Hypervisor vendor: KVM
Virtualization type: full
L1d cache: 32K
L1i cache: 32K
L2 cache: 4096K
NUMA node0 CPU(s): 0


dalam hal ini server saya 1 , maka saya set   worker_processes 1;




root@ubuntu:~# pico /etc/nginx/nginx.conf

tekan Ctrl+w , ketik worker_processes dan ubah nilai dengan 1

kemudian restart service nginx

root@ubuntu:~# service nginx restart
* Restarting nginx nginx [ OK ]
root@ubuntu:~#


Selanjutnya ubah file default , yaitu vhost config nginx yang terdapat di /etc/nginx/sites-available  ke default.lama (untuk membackup file asli)  , pindah ke folder /etc/nginx/sites-available/ kemudian ubah default ke default.lama




root@ubuntu:/# cd /etc/nginx/sites-available/
root@ubuntu:/etc/nginx/sites-available#  mv default default.lama


buat file default baru dan isi seperti berikut




root@ubuntu:/etc/nginx/sites-available# cd /root
root@ubuntu:~# pico /etc/nginx/sites-available/default

edit file default seperti berikut



server {
listen 80;
#listen [::]:80 default_server ipv6only=on;

root /usr/share/nginx/html;
index index.php index.html index.htm;

server_name server_domain_name_or_IP;

location / {
try_files $uri $uri/ =404;
}

error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}



simpan dan exit  tekan Ctrl+X kemudian Enter


*.    Tes konfigurasi




root@ubuntu:~# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
root@ubuntu:~#


jika muncul seperti di atas artinya konfigurasi kita telah betul


terakhir restart service Nginx




root@ubuntu:~# service nginx restart



2.    Install MYSQL


install MYSQL dengan command




root@ubuntu:~# apt-get install mysql-server


akan ada beberapa pertanyaan pada saat proses installasi , dan kemudian anda akan di minta memesukan password




mysql-1


masukan password kemudian konfirmasi pada kotak dialog yang kedua


kemudian eksekusi perintah  mysql_install_db  (mySQL menggunakan sebuah database bernama mysql yang berisikan data - data tentang database server tersebut misalnya pengguna/user, komputer pengakses, sampai dengan hak akses dari user.  Untuk membuat database mysql kita tinggal ketikkan peintah : mysql_install_db)




root@ubuntu:~# mysql_install_db


hilangkan pengaturan keamanan bawaan dengan perintah (default pengaturan keamanan pada saat kita melakukan installasi mysql data base )




root@ubuntu:~# mysql_secure_installation

mysql-2


 3.    Install PHP


install php dengan command




root@ubuntu:~# apt-get install php5-fpm php5-mysql


lalu konfigurasi php processor




root@ubuntu:~# pico /etc/php5/fpm/php.ini

Temukan cgi.fix_pathinfo=1. Jika susah ditemukan, cari dengan ctrl+w kemudian masukan cgi.fix_pathinfo=1. Jika terdapat tanda pagar sebelum cgi.fix_pathinfo=1, silahkan anda hilangkan dan ganti angka 1 menjadi 0. Seperti berikut ini :



cgi.fix_pathinfo=0

php-2

simpan dengan Ctrl+x kemudian enter


kemudian restart service php nya

root@ubuntu:~# service php5-fpm restart


test PHP kita dengan cara Buatlah file baru bernama info.php di root folder Nginx yaitu di  /usr/share/nginx/html

root@ubuntu:~# pico /usr/share/nginx/html/info.php

masukan kode berikut
<?php
phpinfo ();
?>


save dan coba akses di browser domain atau ipserver/info.php
Screenshot from 2015-09-24 19:30:12

 

 

 

 

4.    install phpmyadmin

root@ubuntu:~# apt-get install phpmyadmin

anda akan di minta untuk memilih jenis web server yang di pakai , lewati pada kotak dialog tersebut

pilih yes pada kotak dialog dbconfig-common

phpmyadmin-1

setelah proses selesai akses di browser ipserver atau domain/phpmyadmin

phpmyadmin-3

referensi :

  • http://www.dedeerik.com/cara-install-linux-nginx-mysql-php-lemp-di-ubuntu-14-04/

  • http://bundanartydesign.blogspot.co.id/2011/07/mysql-di-slackware.html

30 comments:

  1. cash advance online cash advance cash advance online personal loan estimate personal loans cheap personal loans personal loans unsecured payday loan lenders only best loan companies online loans online loans loans for bad credit uk payday loan store locations no fax payday loans payday loans payday loans payday loan payday loan a payday loan a payday loan

    ReplyDelete
  2. easy installment loans loans military credit loans for bad credit loan payday

    ReplyDelete
  3. installment loans online online installment loans instant payday loans no credit check installment loans installment loans guaranteed cash advance 2017 cash advances online online installment loans loans for mobile homes fast cash installment loans loan services llc cash advance need money to pay bills payday loan payday loan payday express payday loan payday loans online direct lender payday loan direct payday loan

    ReplyDelete
  4. installment loans online installment loans installment loans guaranteed cash loan for bad credit loans no checking account loans uk payday loans uk express cash advance loans online direct loans online loans online cash loans online guarantor loans payday loan advance payday loan loan relief loans online direct loan program loans online same day cash loans online

    ReplyDelete
  5. overnight loans quick loans advance online payday loans with no credit check no credit check loans online loans online online loans cash advance lenders payday loans instant loan with no credit check payday loans instant loans comparison loans online loans houston online loans cash loans online installment loans i need cash now installment loans installment loans loans payday short term online payday loans no credit check loans payday online cash advance quick loans credit online loan payments personal loans emergency payday loans loans for people with poor credit short term loan lenders installment loans installment loans installment loans guaranteed installment loans guaranteed no credit check loans online loans online personal loans application

    ReplyDelete
  6. loans online best online loans online loan application loans online loans online online loans quick loans online online installment loans loans payday payday loans no fax personal loan companies loans payday money loans no credit check 2000 loan cash advance fast cash advance advance cash payday installment loan calculator loan type quick loans quick loans instant personal loan approval quick loans quick loans payday loans payday loans fast cash loans payday

    ReplyDelete
  7. installment loan bad credit payday loan bad credit personal loans personal loan estimate personal loans loans personal personal loans unsecured personal loans unsecured loans online payday loans online loans in tulsa ok loans online payday loan instant payday loan payday loan no checks online payday loan loan process loans online loans online payday loans without a checking account advance cash cash advance loan cash advance cash advance online

    ReplyDelete