Install LEMP on centos 6.5
(Linux, EngineX (Nginx), Mysql, PHP)
sumber :
http://www.krizna.com/centos/install-lemp-on-centos-6/
==========>>>>> Install Nginx <<<<<==========
1. Download Nginx, dari sini or mirror google
# rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
2. Buat Reposity Nginx
# vi /etc/yum.repos.d/nginx.repo
isi filenya sbb :
-------------------------------------------------------------
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/
gpgcheck=0
enabled=1
--------------------------------------------------------------
3. Update dan install Nginx
# yum check-update
# yum install nginx
4. Jalankan Service Nginx
# /etc/init.d/nginx start
5. Setting Setiap boot selalu on
# chkconfig nginx on
6. Test dari Browser
http://localhost or http://127.0.0.1
-----------------------------------------------------------------
File Konfigurasi standar nginx semuany ada disini
Default document root directory: /usr/share/nginx/html
Default configuration file: /etc/nginx/nginx.conf
Default Virtual host config directory: /etc/nginx/conf.d/
Default Virtual host config file: /etc/nginx/conf.d/default.conf
-----------------------------------------------------------------
=======>>>>> Installasi MYSQL <<<<<=========
1. Install Mysql
# yum install mysql mysql-server
2. Jalankan Service MYSQL
# /etc/init.d/mysqld start
3. Setting Setiap boot selalu on
# chkconfig mysqld on
4. Setting MYSQL dan Password
# /usr/bin/mysql_secure_installation
password root kosong, kemudian isi passwordnya 2 kali
selanjutnya enter, enter aja
5. Tes Mysql menggunakan password yang tadi
# mysql -u root -p
untuk keluar dari mysql>quit; atau mysql>\q
==========>>>>> Installasi PHP <<<<<==========
1. Installasi PHP-FPM
# yum install php-fpm php-mysql
2. Jalankan Service php-fpm
# /etc/init.d/php-fpm start
3. Setting Setiap boot selalu on
# chkconfig php-fpm on
4. Setting File .php biar bisa running di browser
buat file runphp.conf di folder /etc/nginx/conf.d/
# vi /etc/nginx/conf.d/runphp.conf
isi filenya sbb:
------------------------------------------------------------------server {
# Port nya dibedain biar ga bentrok sama apache
listen 8080;
# Nama Servernya localhost bisa diganti domain anda
server_name localhost;
location / {
# folder defaultnya bisa dirubah sesuai keinginan anda
root /usr/share/nginx/html;
index index.php index.html index.htm;
}
location ~ \.php$ {
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
--------------------------------------------------------------------
5. Restart Service nginx
# /etc/init.d/nginx restart
6. test file .php di browser
Buat File test.php di /usr/share/nginx/html
# vi /usr/shar/nginx/html/test.php
isi filenya
---------------------------------------------------
echo "Bismillah, Alhmadulillah PHPnya bisa running";
?>
----------------------------------------------------
7.jalankan dari browser
http://localhost:8080/test.php
atau
http://127.0.0.1:8080/test.php