You are on page 1of 3

Web Server

Tiba-tiba pengen maen-maen


maen PHP di Slackware, mau gak mau akhirnya harus install Apache
web server. Gimana caranya? Begini nih…..

Pertama cek dulu, apakah service-nya


nya udah jalan atau belom. Siapa tau udah berjalan.

root@c1c4x_lab:~# nmap -sS


sS localhost

Starting
ting nmap 3.50 ( http://www.insecure.org/nmap/ ) at 2006
2006-07-29
29 16:13 WIT
Interesting ports on localhost (127.0.0.1):
(The 1653 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
22/tcp open ssh
25/tcp open smtp
37/tcp open time
113/tcp open auth
587/tcp open submission
6000/tcp open X11

Nmap run completed -- 1 IP address (1 host up) scanned in 1.056 seconds

ow, ternyata service httpd belom berjalan. So mari kita mulai. apache terletak di direktori
/etc/apache terus edit file httpd.conf

root@c1c4x_lab:~# cd /etc/apache
root@c1c4x_lab:/etc/apache# pico httpd.conf

Untuk mengaktifkan modul PHP, agar apache bisa mengeksekusi .php maka aktifkan baris
Include /etc/apache/mod_php.conf dengan menghapus tanda # (pagar), biasanya terletak di
bawah sendiri. Kalo pengen apache--nya
nya mendukung SSL (Secure Socket Layer), maka aktifkan
juga modul SSL-nya.

....baris atas sengaja di hapus....


# ==> mod_php configuration settings mod_ssl configuration settings < ==
#
# PACKAGES REQUIRED:
UIRED: apache (N series) and openssl (N series)
#
Include /etc/apache/mod_ssl.conf

Jalankan servicenya:

root@c1c4x_lab:/etc/apache# /etc/rc.d/rc.httpd start


-bash:
bash: /etc/rc.d/rc.httpd: Permission denied

Lho koq denied? Oh iya lupa, file permissionnya belom execute. Kalo gak percaya mari kita lihat
dan buktikan Pergi ke drektori /etc/rc.d

root@c1c4x_lab:~# cd /etc/rc.d
root@c1c4x_lab:/etc/rc.d# ls -al rc.httpd
-rw-r--r-- 1 root root 401 2003
2003-03-06 04:28 rc.httpd
Tuh kan, permissionnya masih default yaitu 6644,
44, so perlu diganti dulu permissionnya.

root@c1c4x_lab:/etc/rc.d# chmod 755 rc.httpd


root@c1c4x_lab:/etc/rc.d# ls -al rc.httpd
-rwxr-xr-x
x 1 root root 401 2003
2003-03-06 04:28 rc.httpd*

sekarang jalankan service-nya,


nya, kemudian test pake nmap.

root@c1c4x_lab:/etc/rc.d#
tc/rc.d# /etc/rc.d/rc.httpd start
/usr/sbin/apachectl start: httpd started
root@c1c4x_lab:/etc/rc.d# nmap -sS localhost

Starting nmap 3.50 ( http://www.insecure.org/nmap/ ) at 2006


2006-07-29
29 16:24 WIT
Interesting ports on localhost (127.0.0.1):
(The 1652 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
22/tcp open ssh
25/tcp open smtp
37/tcp open time
80/tcp open http === service httpd telah berjalan
113/tcp open auth
587/tcp open submission
6000/tcp open X11

Selain command /etc/rc.d/rc.httpd start


start, bisa juga digunakan command apachectl,, seperti
berikut:

root@c1c4x_lab:/etc/rc.d# apachectl stop


/usr/sbin/apachectl stop: httpd stopped
root@c1c4x_lab:/etc/rc.d# apachectl start
/usr/sbin/apachectl start: httpd sta
started

Direktori htdocs, secara default terletak di /var/www/htdocs.. Direktory bisa diubah dengan
melakukan edit di httpd.conf
Sekarang kita cek di browser, apakah service telah berjalan dengan baik. Dan apakah web server
telah mendukung php. Bwat file phpin
phpinfo.php,
fo.php, untuk menguji apakah web server bisa
menjalankan .php
http://localhost == telah berjalan dengan semestinya

http://localhost/phpinfo.php == dapat berjalan berarti telah mendukung .php

You might also like