Instalasi Lighttpd

From OnnoWiki
Revision as of 08:09, 5 April 2011 by Onnowpurbo (talk | contribs)
Jump to navigation Jump to search

Sumber: http://www.howtoforge.com/installing-lighttpd-with-php5-and-mysql-support-on-ubuntu-9.10


Lighttpd adalah web server yang aman, cepat dan comply yang di rancang untuk lingkungan yang sangat membutuhkan kecepatan. Tutorial ini akan memperlihatkan bagaimana menginstalasi Lighttpd di Server Ubuntu dengan dukungan PHP5 dan MySQL.

Catatan Awal

Pada tutorial ini akan digunakan

hostname   server1.example.com
IP address 192.168.0.9

Dalam tutorial ini kita perlu login sebagai root, pastikan menjalankan perintah

sudo su


Instalasi MySQL

Melalui perintah

sudo apt-get install mysql-server mysql-client lightttpd php5-cgi \
php5 php5-xmlrpc php5-mysql php5-gd php5-cli php5-curl

Disini kita akan di tanya password root,

New password for the MySQL "root" user: passwordrootanda
Repeat password for the MySQL "root" user: passwordrootanda

Beberapa folder / file penting

/var/www - tempat file HTML
/etc/lighttpd/lighttpd.conf - file konfigurasi
/etc/lighttpd/conf-available - tambahan konfigurasi

Untuk enable konfigurasi

lighttpd-enable-mod

perintah ini akan membuat symlink dari directory /etc/lighttpd/conf-enabled ke file konfigurasi di /etc/lighttpd/conf-available

Untuk mendisable konfigurasi menggunakan perintah

lighttpd-disable-mod


Konfigurasi Lighttpd dan PHP5

Untuk mengaktifkan PHP5 di Lighttpd, kita harus mengedit /etc/php5/cgi/php.ini

vi /etc/php5/cgi/php.ini 

Tambahkan di akhir file

[...]
cgi.fix_pathinfo = 1

Untuk mengaktifkan konfigurasi fastcgi (yang di simpan di /etc/lighttpd/conf-available/10-fastcgi.conf), jalankan perintah berikut

lighttpd-enable-mod fastcgi

This creates a symlink /etc/lighttpd/conf-enabled/10-fastcgi.conf which points to /etc/lighttpd/conf-available/10-fastcgi.conf:

ls -l /etc/lighttpd/conf-enabled


cek

ls -l /etc/lighttpd/conf-enabled
total 0
lrwxrwxrwx 1 root root 44 2009-11-13 17:36 10-fastcgi.conf -> /etc/lighttpd/conf-available/10-fastcgi.conf

Reload Lighttpd:

/etc/init.d/lighttpd force-reload



6 Testing PHP5 / Getting Details About Your PHP5 Installation


The document root of the default web site is /var/www. We will now create a small PHP file (info.php) in that directory and call it in a browser. The file will display lots of useful details about our PHP installation, such as the installed PHP version.

vi /var/www/info.php

<?php phpinfo(); ?>

Now we call that file in a browser (e.g. http://192.168.0.100/info.php):

Click to enlarge

As you see, PHP5 is working, and it's working through FastCGI, as shown in the Server API line. If you scroll further down, you will see all modules that are already enabled in PHP5. MySQL is not listed there which means we don't have MySQL support in PHP5 yet.


Referensi

Pranala Menarik