PENYELESAIAN
NO 4
Umumnya file yang diakses http://www.something.com adalah
file index.html atau index.php di folder htdocs (kalau di apache windows) atau
di /var/www/html (untuk apache server linux). Namun ada kalanya kita sebagai
pemilik web server tersebut berkeinginan untuk memberikan fasilitas kepada user
yakni berupa homepage mereka. Buatlah configurasi Web server agar memiliki
fasilitas user dapat memiliki web pagenya sendiri (mod_userdir).
Caranya:
1. sudo a2enmod userdir
Setelah itu kita konfigurasi Apachenya.
2. sudo nano /etc/apache2/mods-enabled/userdir.conf
3. Ganti dengan code 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>
</IfModule>
4. Kemudian
sudo nano /etc/apache2/mods-available/php5.conf
5. Ganti
dengan source code ini:
<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>
6. Restart
Apache Anda
service
apache2 restart
mkdir
/home/$USER/public_html disini saya mkdir /home/admin/public_html
7. Kemudian,
buat file index.html
nano
index.html
lalu isi
text html disana
8. Test dengan cara: lynx localhost:80/public_html
PENYELESAIAN
NO 5
Kita mendapat kasus bagaimana configurasi webserver
agar dapat menggunakan SSL pada Apache HTTP Server anda dengan studi kasus :
self-signed-certificate.
1. Masuk ke komputer host Anda. Disini, saya memakai
komputer host bernama tiga yang
berlaku sebagai web server
2. Matikan apache -> service apache2 stop
3. a2enmod ssl
4. Generate CSR : openssl req -new > new.ssl.csr
Generating a 1024 bit RSA private key
................++++++ ........................++++++ writing new private key
to 'privkey.pem' Enter PEM pass phrase: Verifying - Enter PEM pass phrase:
----- You are about to be asked to enter information that will be incorporated
into your certificate request. What you are about to enter is what is called a
Distinguished Name or a DN. There are quite a few fields but you can leave some
blank For some fields there will be a default value, If you enter '.', the
field will be left blank. ----- Country Name (2 letter code) [AU]:Enter Code
Here State or Province Name (full name) [Some-State]:Enter State Here
Locality Name (eg, city) []:Enter City Here Organization Name (eg,
company) [Internet Widgits Pty Ltd]:Enter Company Name Organizational
Unit Name (eg, section) []:Org Unit (if you have one) Common Name (eg,
YOUR name) []:First and Last Name Email Address []:Work Email
Please enter the following 'extra' attributes to be sent with your certificate
request A challenge password []:Leave Blank An optional company name []:Optional
5. Generate Sertificate :
openssl rsa -in privkey.pem -out new.cert.key
openssl x509 -in new.ssl.csr -out new.cert.new.ssr.csr
-req -signkey new.cert.key -days (berapa jumlah hari)
cp new.cert.cert /etc/ssl/certs/server.crt
cp new.cert.key /etc/ssl/private/server.key
6.
Configurasi apache
nano
/etc/apache2/sites-available/mydomain.net
Kalau di
komputer saya, nano /etc/apache2/sites-available/default
Kemudian isi
code berikut di baris terbawah :
SSLEngine on
SSLOptions
+StrictRequire
SSLCertificateFile
/etc/ssl/certs/server.crt
SSLCertificateKeyFile
/etc/ssl/private/server.key
PENYELESAIAN
NO 6
Kali ini kita akan melakukan konfigurasi buat
nge-optimasi Apache dengan asumsi guaranted RAM sebesar 8 MB.
Lalu, bagaimana cara konfigurasinya?
Berikut mari kita ulas satu persatu step-step-nya:
1. Ketik “top “
2. Ketik “shift + m”
3. Catat nilai RES tertingginya yang digunakan oleh
httpd nya
4. ketik “Q” buat kembali
5. Matikan httpdnya. service apache2 stop
6. free -m
7. Catat nilai yang dicatat oleh used
8. Berapa nilai apache yang ada muncul. Seharusnya adalah
8 MB
9. Kalikan dengan 0.8 dan buatkan rata-rata AVAILABLE
APACHE POOL
10. Bagi AVAILABLE APACHE POOL dengan nilai RES
tertinggi
11. Open httpd.conf . Syntax: nano
/etc/apache2/apache2.conf
12. Set MaxClients yang sebelumnya sudah dihitung
13. Set KeepAlive jadi Off. Mengapa OFF? Karena kalau ON
nanti server akan menangani banyak request per detik. Pasti akan membutuhkan
banyak memori yang dibutuhkan. Jadi amannya di OFF kan saja
14. Set Timeout jadi nilai normal. Saya set menjadi 30
15. Set MaxKeepAliveRequest antara 70-200. Kalau saya
set menjadi 80
16. Set MinSpareServers yaitu 10-20% MaxClient
17. Set MaxSpareServers yaitu 10-20% MaxClient
18. Set StartServers sama dengan MaxSpareServers dan
MinSpareServers
19. Set MaxRequestsPerChild antara 500-10000. Kalau
saya set menjadi 10000
20. Lalu save konfigurasinya. Jangan lupa diaktifkan
kembali apachenya. Caranya: service apache2 start
Tidak ada komentar:
Posting Komentar