Web Server Apache.
Konsep Dari Web bekerja dalam konsep client – server.
Web client meminta halaman (dokumen web) kepadaweb server melalui jaringan komputer. Web server merespon dengan mencarikan dokumen(halaman) pada lokasi penyimpanan dokumen web yang ada pada web server. Selanjutnya webserver mengirimkannya kepada web client.
Contoh aplikasi web client: Mozilla Firefox, IE, Opera, Safari, Chrome dan lain lain Contoh aplikasi web server: Apache, IIS, Nginx, lighttpd, tomcat dan lain lain.
ok gan langsung saja tanpa basa basi untuk penjelasan mengenai apache. Mungkin kalau yang masih awam-awam banget biasanya dalam benak seorang akan bertanya-tanya. Apasih itu APACHE?
Apache Merupakan aplikasi web server default di CentOS 6.
Nama paket softwarenya adalah httpd. Demikian pula nama servicenya sama yaitu httpd. Sedangkan port default yang digunakan adalah port 80. File konfigurasi utamanya ada di /etc/httpd/conf/httpd.conf sedangkan file konfigurasi tambahan dapat disimpan di direktori /etc/httpd/conf.d dengan menggunakan ekstensi .conf. Direktori default untuk menyimpan filefile html atau biasa disebut dengan Document Root terdapat di /var/www/html.
Instalasi Apache Untuk memeriksa ketersediaan paket httpd jalankan perintah berikut:
[root@pcserverfauzi ~]# rpm qa | grep httpd atau bisa juga
[root@pcserverfauzi ~]# rpm q httpd
package httpd is not installed Apabila paket httpd belum diinstal, jalankan berintah berikut untuk menginstalnya:
[root@pcserverfauzi ~]# yum y install httpd
Mengelola Service Apache Sebagai berikut :
Menjalankan service apache:
# service httpd start
Menghentikan service apache:
# service httpd stop
Merestart service apache:
# service httpd restart
Memeriksa status serviec apache:
# service httpd status
Konfigurasi Direktory Di Apache.
Contoh konfigurasi direktori:
Cara Kerja Web Server :<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride none
Order allow,deny
Allow from all
</Directory>
Keterangan:
Indexes : filefile di dalam direktori dapat diakses tanpa file indexFollowSymLinks : biar bisa menggunakan symbolic link
AllowOverride none : fitur untuk autentikasi dalam hal ini dinonaktifkan
Order allow,deny : urutan hak akses ke direktori
Allow from all : diperbolehkan dari semua IP, contoh lain : Allow from 192.168.1.0/24
Konfigurasi User Director.
Fungsinya agar setiap user bisa menyimpan halaman websitenya di home directory masing-masing. Diakses dengan menggunakan URL: http://hostname/~userContoh :
User badu dapat diakses websitenya di alamat http://localhost/~fauzi
Langkahlangkah pengaturan konfigurasinya:
1. Edit file /etc/httpd/conf/httpd.conf, kemudian beri komentar (tanda #) pada baris UserDir Disabled dan hapus komentar (tanda #) pada baris UserDir public_html sehingga menjadi seperti contohdi bawah ini:
<IfModule mod_userdir.c>
#
# UserDir is disabled by default since it can confirm the presence
# of a username on the system (depending on home directory
# permissions).
#
# UserDir disabled
#
# 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
</IfModule>
Catatan:
public_html adalah nama direktori yang harus ada pada home directory user untuk menyimpan file file html. Nama direktori ini dapat diganti sesuai keinginan.2. Edit file /etc/httpd/conf/httpd.conf, kemudian hapus komentar (tanda #) pada barisbaris berikut:
<Directory /home/*/public_html>AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
3. Restart service apache
[root@pcserverfauzi ~]# service httpd restart4. Buat direktori public_html pada home directory user fauzi
[root@pcserver ~]# su badu[badu@pcserver ~]$ mkdir public_html
[badu@pcserver ~]$ cd public_html
5. Buat file index.html pada direktori public_html untuk menampilkan halaman web, contoh isinya sbb:
[badu@pcserver public_html]$ vim index.html<h1 style="textalign:center">Halaman Web Fauzi</h1>
6. Ubah permissions direktori /home/badu menjadi 711
[badu@pcserver ~]$ chmod 711 /home/badu7. Jalankan web browser kemudian akses alamat url berikut :
http://192.168.100.10/~fauzi
Konfigurasi Alias Direktori
Menampilkan halaman web dari direktori lain seakanakan berada di Document Root.Contoh : Direktori /home/data dapat diakses dengan url http://localhost/data
Langkahlangkah pengaturan konfigurasinya:
1. Buat file /etc/httpd/conf.d/alias.conf, tambahkan barisbaris berikut di dalamnya:
[root@pcserverfauzi ~]# vim /etc/httpd/conf.d/alias.confAlias /data "/home/data/"
<Directory "/home/data/">
Options Indexes FollowSymLinks
AllowOverride none
Order allow,deny
Allow from all
</Directory>
2. Restart service apache
[root@pcserver ~]# service httpd restart3. Buat direktori /home/data
[root@pcserver ~]# mkdir /home/data4. Jalankan web browser kemudian akses alamat url berikut :
http://192.168.100.10/dataKonfigurasi Virtual Host
Fungsinya menampilkan halaman yang berbeda untuk setiap domain yang diarahkan ke komputer tersebut.Langkahlangkah pengaturan konfigurasinya:
1. Edit file /etc/httpd/conf/httpd.conf, kemudian tambahkan barisbaris berikut di bagian akhir file:
[root@pcserver ~]# vim /etc/httpd/conf/httpd.confNameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin root@fauzi.oke
DocumentRoot /var/www/html
ServerName www.dudi.oke
ErrorLog logs/www.dudi.okeerror.log
CustomLog logs/www.dudi.okeaccess.log common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin root@fauzi.oke
DocumentRoot /home/blog
ServerName blog.dudi.oke
ErrorLog logs/blog.fauzi.okeerror.log
CustomLog logs/blog.dudi.okeaccess.log common
</VirtualHost>
2. Restart service apache
[root@pcserver ~]# service httpd restart3. Buat direktori /home/blog
[root@pcserver ~]# mkdir /home/blog4. Buat file index.html pada direktori /home/blog untuk menampilkan halaman web, contoh isinya sbb:
[root@pcserver ~]$ vim /home/blog/index.html <h1 style="textalign:center">blog.fauzi.oke</h1>sekian. semoga bermanfaat. dan langsung di appalay gan sekaligus praktek.
copyright by ©_fauzi rohman syah.
Comments
Post a Comment