Sabtu, 13 April 2013

bebrapa cara setting di apache


mod_dir memodifikasi direktori di apache


mod_dir digunakan untuk memodifikasi direktori yang ada seperti saat ketika kita mengakses ip_anda:80/example maka akan diarahkan ke ip_anda:80/example/example.html

contoh :

# Example A: Set index.html as an index page, then add index.php to that list as well.
<Directory /foo>
    DirectoryIndex index.html
    DirectoryIndex index.php
</Directory>

# Example B: This is identical to example A, except it's done with a single directive.
<Directory /foo>
    DirectoryIndex index.html index.php
</Directory>

# Example C: To replace the list, you must explicitly reset it first:
# In this example, only index.php will remain as an index resource.
<Directory /foo>
    DirectoryIndex index.html
    DirectoryIndex disabled
    DirectoryIndex index.php
</Directory>

mod_userdir  di apache

lakukan perintah : a2enmod userdir
kemudian edit script : nano /etc/apache2/mods-enabled/userdir.conf
hingga menjadi seperti dibawah ini

<IfModule mod_userdir.c>
        UserDir public_html
        UserDir disabled root
 
        <Directory /home/*/public_html>
AllowOverride All
Options MultiViews Indexes SymLinksIfOwnerMatch
<Limit GET POST OPTIONS>
       Order allow,deny
       Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
       Order deny,allow
       Deny from all
</LimitExcept>
        </Directory>

lakukan edit script : nano /etc/apache2/mods-available/php5.conf
hingga menjadi seperti ini dengan memberikan comment dengan "#"

<IfModule mod_php5.c>
    <FilesMatch "\.ph(p3?|tml)$">
SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch "\.phps$">
SetHandler application/x-httpd-php-source
    </FilesMatch>
    # To re-enable php in user directories comment the following lines
    # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
    # prevents .htaccess files from disabling it.
    #<IfModule mod_userdir.c>
    #    <Directory /home/*/public_html>
    #        php_admin_value engine Off
    #    </Directory>
    #</IfModule>
</IfModule>

lakukan restart pache dengan perintah : service apache2 restart
buat folder public_html di $user(root) dengan perintah : mkdir /home/$USER/public_html

akses melalui host/client dengan perintah : lynx 170.0.0.101/c8

configurasi webserver agar dapat menggunakan SSL pada Apache HTTP Server anda dengan studi kasus :  self-signed-certificate..

lakukan perintah : a2enmod ssl

buat folder dengan perintah : mkdir /etc/apache2/ssl

dapatkan certificate dengan perintah dibawah ini :
openssl req -new -x509 -days 365 -nodes -out /etc/apache2/ssl/apache.pem -keyout /etc/apache2/ssl/apache.key

isi setingan seperti dibawah ini :
Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:New Jersey
Locality Name (eg, city) []:Absecon
Organization Name (eg, company) [Internet Widgits Pty Ltd]:SoftwareDev, LLC
Organizational Unit Name (eg, section) []:Web Services
Common Name (eg, YOUR name) []:archimedes.mydomain.com
Email Address []:support@mydomain.com


lakukan restart pada apache : service apache2 restart

untuk meng-enable ssl lakukan perintah : a2ensites default-ssl

edit script : nano /etc/apache2/sites-enabled/default-ssl
dengan menganti certificate file pakai :
/etc/apache2/ssl/apache.pem  
/etc/apache2/ssl/apache.key

untuk lebih lengkapnya liat di sumber sel-signed certificate ssl


Tidak ada komentar:

Posting Komentar