ServerWeb pada FreeBSD 4.9
filed in Jaringan on Jun.12, 2006
Webserver merupakan sesuatu yang vital bagi suatu group atau kelompok untuk mempublikasikan kegiatan-kegiatan ataupun serba-serbi mengenai group atau kelompok tersebut sehingga orang lain atau masyarakat umum bisa tahu mengenai group atau kelompok itu. Dan di sini akan di berikan langkah-langkah dalam membangun suatu webserver apache.
Mysql di dalam webserver di pakai sebagai tempat penyimpanan database dalam sebuah webserver, berikut adalah langkah-langkah dalam instalasi MySQL,
1. buat group dan user mysql
#pw groupadd mysql
#pw useradd mysql -g mysql -d /usr/local/mysql -s /nonexistent
2. decompress package mysql.tar.gz
#cd /usr/local/
#tar -zxvf mysql.tar.gz
#ln -s path-to-mysql mysql
#cd mysql
#scripts/mysql_install_db
#chown -R root .
#chown -R mysql data
#chgrp -R mysql .
#bin/mysqld_safe –user=mysql &
bila menggunakan mysql 4.xOpenSSL
1. compile source openssl
#cd /home/src
#tar -zxvf openssl-0.9.6l.tar.gz
#cd openssl-0.9.6l.tar.gz
#./config no-threads -fPIC
#make;make install2. Generate file private key
#cd /usr/local/ssl
#bin/openssl genrsa -out private/www.domain.com.key 1024
ubah set permission file direktori private
#chown -R root:root private
#chmod -R 600 private
#chmod u+X private3. Generate file CSR (certificate signing request)
#bin/openssl req -new -key private/webmail.yourdomain.com.key -out certs/webmail.yourdomain.com.csrCountry Name (2 letter code) [AU]:AU
State or Province Name (full name) [Some-State]:Your State
Locality Name (eg, city) []:Your City
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Your Company Pty Ltd
Organizational Unit Name (eg, section) []:Internet Services
Common Name (eg, your name or your server’s hostname) []:webmail.yourdomain.com
Email Address []:postmaster@yourdomain.comPlease enter the following ‘extra’ attributes to be sent with your certificate request
A challenge password []:yoursecretpasswd
An optional company name []:4. certificate
untuk mendapatkan signing certificate bisa mengakses secara online melalui www.thawte.com,
setelah mendapatkan certificate copy ke /usr/local/ssl/certs/www.domain.com.crt
atau dgn menggunakan alternatif lain
#bin/openssl x509 -req -days 30 -in certs/www.domian.com.csr -out certs/webmail.yourdomain.com.crt -signkey private/webmail.yourdomain.com.keyApache webserver (Mod_SSL dan PHP)
1. buat group dan user apache
#pw groupadd www
#pw useradd www -d /usr/local/www -s /nonexistent
compile source
#cd /home/src
#tar -zxvf apache-1.3.29
2. module modssl
untuk mendapatkan module/source versi terbaru modssl bisa melalui www.modssl.org,
mod_ssl memberikan fungsi crytographic untuk webserver Apache.
Extract source
#cd /home/src
#tar -zxvf mod_ssl.tar.gz
#cd mod_ssl
#./configure –with-apache=../apache_1.3.2x –with-crt=/usr/local/ssl/certs/www.domain.com.crt –with-key=/usr/local/ssl/certs/www.domain.com.key
compile source apache
#cd ../apache_1.3.2x
#env SSL_BASE=../openssl ./configure –prefix=/usr/local/www –enable-module=so –enable-module=rewrite –enable-shared=rewrite
–enable-module=ssl –enable-shared=ssl –disable-rule=SSL-COMPAT
#make;make install
kemudian tambahkan module untuk script php
#tar -zxvf php.tar.gz
#cd php
#./configure –with-mysql=/usr/local/mysql –with-apxs=/usr/local/www/bin/apxs
#make;make install
#cp php.ini-dist /usr/local/lib/php.ini
ubah file php.ini dan pastikan terdapat perintah berikut
max_execution_time=60
memory_limit=10M
post_max_size=8M
upload_max_filesize=8M
file_uploads=On
log_errors=On
error_log=/usr/local/www/logs/php_error_log
ubah permission dari direktori php
#chown -R root:www /usr/local/lib/php
#chmod -R g-w,o-rwx /usr/local/lib/php
Edit file /usr/local/www/conf/httpd.conf
User www
Group www
ServerAdmin postmaster@yourdomain.com
ServerName www.yourdomain.com
# Following line should be present already as it would be inserted by the PHP make
# Make sure you move it outside of the IfDefineSSL section if the make (incorrectly) put it there
LoadModule php4_module libexec/libphp4.so
# uncomment (or add) the following line
AddType application/x-httpd-php .php
# Add the index.php into this line so apache will use this file as a default in addition to index.html
DirectoryIndex index.php index.html
# Go towards the end of the httpd.conf and look for the “SSL Virtual Host Context”
ServerName www.yourdomain.com
ServerAdmin postmaster@yourdomain.com
Test file httpd.conf untuk melihat apakah command-command yg di berikan sudah benar
#/usr/local/www/bin/apachectl configtest
jika menggunakan SSL
#/usr/local/www/bin/apachectl startssl
dan jika tidak menggunakan SSL
#/usr/local/www/bin/apachectl start
Dan untuk melihat apakah webserver kita sudah berjalan dgn baik ,
#ps axf|grep httpd
setan# ps axf|grep httpd
133 ?? Ss 0:02.18 /var/www/bin/httpd -DSSL
143 ?? I 0:00.04 /var/www/bin/httpd -DSSL
144 ?? I 0:00.05 /var/www/bin/httpd -DSSL
145 ?? I 0:00.02 /var/www/bin/httpd -DSSL
jika mendapatkan hasil seperti di atas berarti webserver kita sudah siap, kemudian tambahkan baris apachectl ke dalam /etc/rc.local.
NB:
konfigurasi di sesuaikan dgn mesin Anda
Â

Leave a Reply