Difference between revisions of "Instalasi Lighttpd"

From OnnoWiki
Jump to navigation Jump to search
(New page: Sumber: http://www.howtoforge.com/installing-lighttpd-with-php5-and-mysql-support-on-ubuntu-9.10 Lighttpd is a secure, fast, standards-compliant web server designed for speed-critical en...)
 
 
(7 intermediate revisions by the same user not shown)
Line 2: Line 2:
  
  
Lighttpd is a secure, fast, standards-compliant web server designed for speed-critical environments. This tutorial shows how you can install Lighttpd on an Ubuntu 9.10 server with PHP5 support (through FastCGI) and MySQL support.
+
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.
  
I do not issue any guarantee that this will work for you!
+
==Catatan Awal==
  
+
Pada tutorial ini akan digunakan
1 Preliminary Note
 
 
 
In this tutorial I use the hostname server1.example.com with the IP address 192.168.0.100. These settings might differ for you, so you have to replace them where appropriate.
 
 
 
I'm running all the steps in this tutorial with root privileges, so make sure you're logged in as root:
 
  
sudo su
+
hostname  server1.example.com
 +
[[IP address]] 192.168.0.9
  
+
Dalam tutorial ini kita perlu login sebagai root, pastikan menjalankan perintah
2 Installing MySQL 5
 
  
First we install MySQL 5 like this:
+
sudo su
  
aptitude install mysql-server mysql-client
 
  
You will be asked to provide a password for the MySQL root user - this password is valid for the user root@localhost as well as root@server1.example.com, so we don't have to specify a MySQL root password manually later on:
+
==Instalasi==
  
New password for the MySQL "root" user: <-- yourrootsqlpassword
+
Melalui perintah
Repeat password for the MySQL "root" user: <-- yourrootsqlpassword
 
  
 +
sudo apt-get install mysql-server mysql-client lighttpd php5-cgi \
 +
php5 php5-xmlrpc php5-mysql php5-gd php5-cli php5-curl
 
   
 
   
3 Installing Lighttpd
+
Disini kita akan di tanya password root,
  
Lighttpd is available as an Ubuntu package, therefore we can install it like this:
+
New password for the MySQL "root" user: passwordrootanda
 +
Repeat password for the MySQL "root" user: passwordrootanda
  
aptitude install lighttpd
+
Beberapa folder / file penting
  
Now direct your browser to http://192.168.0.100, and you should see the Lighttpd placeholder page:
+
/var/www - tempat file HTML
 +
/etc/lighttpd/lighttpd.conf - file konfigurasi
 +
/etc/lighttpd/conf-available - tambahan konfigurasi
  
Click to enlarge
+
Untuk enable konfigurasi
  
Lighttpd's default document root is /var/www on Ubuntu, and the configuration file is /etc/lighttpd/lighttpd.conf. Additional configurations are stored in files in the /etc/lighttpd/conf-available directory - these configurations can be enabled with the lighttpd-enable-mod command which creates a symlink from the /etc/lighttpd/conf-enabled directory to the appropriate configuration file in /etc/lighttpd/conf-available. You can disable configurations with the lighttpd-disable-mod command.
+
lighttpd-enable-mod
  
+
perintah ini akan membuat symlink dari directory /etc/lighttpd/conf-enabled ke file konfigurasi di /etc/lighttpd/conf-available
4 Installing PHP5
 
  
We can make PHP5 work in Lighttpd through FastCGI. Fortunately, Ubuntu provides a FastCGI-enabled PHP5 package which we install like this:
+
Untuk mendisable konfigurasi menggunakan perintah
  
aptitude install php5-cgi
+
lighttpd-disable-mod
  
+
==Konfigurasi Lighttpd dan PHP5==
5 Configuring Lighttpd And PHP5
 
  
To enable PHP5 in Lighttpd, we must modify /etc/php5/cgi/php.ini and add the line cgi.fix_pathinfo = 1 right at the end of the file:
+
Untuk mengaktifkan PHP5 di Lighttpd, kita harus mengedit /etc/php5/cgi/php.ini
  
vi /etc/php5/cgi/php.ini
+
vi /etc/php5/cgi/php.ini  
  
[...]
+
Tambahkan di akhir file
cgi.fix_pathinfo = 1
 
  
To enable the fastcgi configuration (which is stored in /etc/lighttpd/conf-available/10-fastcgi.conf), run the following command:
+
[...]
 +
cgi.fix_pathinfo = 1
  
lighttpd-enable-mod fastcgi
+
Untuk mengaktifkan konfigurasi fastcgi (yang di simpan di /etc/lighttpd/conf-available/10-fastcgi.conf), jalankan perintah berikut
  
This creates a symlink /etc/lighttpd/conf-enabled/10-fastcgi.conf which points to /etc/lighttpd/conf-available/10-fastcgi.conf:
+
lighttpd-enable-mod fastcgi
  
ls -l /etc/lighttpd/conf-enabled
+
perintah di atas akan membuat symlink /etc/lighttpd/conf-enabled/10-fastcgi.conf ke /etc/lighttpd/conf-available/10-fastcgi.conf:
  
root@server1:~# ls -l /etc/lighttpd/conf-enabled
+
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
 
root@server1:~#
 
  
Then we reload Lighttpd:
+
cek
  
/etc/init.d/lighttpd force-reload
+
ls -l /etc/lighttpd/conf-enabled
  
 +
total 0
 +
lrwxrwxrwx 1 root root 44 2011-04-05 09:06 10-fastcgi.conf -> /etc/lighttpd/conf-available/10-fastcgi.conf
  
 +
Reload Lighttpd:
  
6 Testing PHP5 / Getting Details About Your PHP5 Installation
+
/etc/init.d/lighttpd force-reload
 
  
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
+
==Test PHP5==
phpinfo();
 
?>
 
  
Now we call that file in a browser (e.g. http://192.168.0.100/info.php):
+
Edit file
 
 
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.
 
 
 
 
7 Getting MySQL Support In PHP5
 
  
To get MySQL support in PHP, we can install the php5-mysql package. It's a good idea to install some other PHP5 modules as well as you might need them for your applications. You can search for available PHP5 modules like this:
+
vi /var/www/info.php
  
aptitude search php5
+
Isi dengan perintah
  
 +
<?php
 +
phpinfo();
 +
?>
  
 +
Akses menggunakan browser ke alamat
  
 +
http://192.168.0.9/info.php
  
 +
Kita akan melihat bahwa PHP5 berjalan dengan baik melalui FastCGI, tampak pada kalimat Server API.
  
  
Line 111: Line 101:
 
==Pranala Menarik==
 
==Pranala Menarik==
  
 +
* [[Lighttpd: Ubah Port Web]]
 
* [[Linux Howto]]
 
* [[Linux Howto]]
  
 
[[Category: Linux]]
 
[[Category: Linux]]

Latest revision as of 12:39, 5 April 2011

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

Melalui perintah

sudo apt-get install mysql-server mysql-client lighttpd 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

perintah di atas akan membuat symlink /etc/lighttpd/conf-enabled/10-fastcgi.conf ke /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 2011-04-05 09:06 10-fastcgi.conf -> /etc/lighttpd/conf-available/10-fastcgi.conf

Reload Lighttpd:

/etc/init.d/lighttpd force-reload


Test PHP5

Edit file

vi /var/www/info.php

Isi dengan perintah

<?php
phpinfo();
?>

Akses menggunakan browser ke alamat

http://192.168.0.9/info.php

Kita akan melihat bahwa PHP5 berjalan dengan baik melalui FastCGI, tampak pada kalimat Server API.


Referensi

Pranala Menarik