Archive

Archive for February, 2012

FC 16: Install Apache dan PHP

February 21, 2012 Leave a comment

Buat sekedar catatan, untuk membuat sebuah web server menggunakan Fedora (sekarang lagi eranya Fedora 16), mudah saja.

Install beberapa hal berikut:

# yum install httpd

# yum install php php-common php-pecl-apc php-cli php-pear php-pdo php-mysql

Untuk sebagai tes, apakah web dan PHP sudah bekerja dengan baik, buat sebuah file info.php di /var/www/html

    <?php

        phpinfo();

    ?>

file html juga bisa ditaruh di user directory. Hanya saja beberapa setting harus diperhatikan:
buat direktori public_html di home directory, dan buka akses ke direktori tersebut:

$ cd
$ mkdir public_html
$ chmod a+x .
$ chmod a+x public_html

edit file /etc/httpd/conf/httpd.conf, set UserDir -> Enable

    #
    # UserDir is disabled by default since it can confirm the presence
    # of a username on the system (depending on home directory
    # permissions).
    #
    UserDir enabled testuser
 
    #
    # To enable requests to /~user/ to serve the user's public_html
    # directory, remove the "UserDir disabled" line above, and uncomment
    # the following line instead:
    #
    UserDir public_html

Setelah itu restart httpd.
Untuk security, SELINUX akan memblok akses tersebut. Buka akses dengan perintah:

# setsebool -P httpd_enable_homedirs true

SELINUX juga akan memblok akses ke mysql. Buka juga akses itu dengan:


# grep httpd /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Silahkan mencoba. :)

Follow

Get every new post delivered to your Inbox.