Langkah ini dijalankan dengan tujuan untuk membuat sub domain dari website awal yang sudah kita miliki. MIsalnya dari website www.agungprasetyo.net, kita ingin menambah sub domain websiteku.agungprasetyo.net dan seterusnya.
1. pertama-tama, buatlah folder untuk menampung file-file html yang nantinya akan diupload.
root@library:~#mkdir /var/www/website
2. Selanjutnya, kita akan melakukan konfirgurasi di apache. Masuk ke direktori sites-available
root@library:~#cd /etc/apache2/sites-available
3. Jika dilihat, disana ada file default dan default-ssl yang merupakan file awal terbantuknya apache2. Sekarang buat file baru
root@library:/etc/apache2/sites-available#nano websiteku



4. Tambahkan isi file berikut :
<VirtualHost 212.166.10.230:80>
ServerAdmin admin@agungprasetyo.net
ServerName website.agungprasetyo.
ServerAlias website.agungprasetyo.net
DocumentRoot /var/www/website
ErrorLog /var/log/apache2/error-website.log
CustomLog /var/log/apache2/access-website.log combined

<Directory /var/www/website>
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

</VirtualHost>
5. Lakukan penyimpanan pada file tersebut
6. Karena kita ingin menambahkan nama baru, maka kita tidak perlu menonaktifkan yang lama. Kita tinggal mengaktifkan saja nama yang baru saja kita buat.
root@library:/etc/apache2/sites-available#a2ensite websiteku
Enabling site website.
Run ‘/etc/init.d/apache2 reload’ to activate new configuration!
7. Hasilnya bisa anda lihat dengan perintah
root@library:/etc/apache2/sites-available#ls -l ../sites-enabled/
lrwxrwxrwx 1 root root 26 2009-03-23 11:39 000-default -> ../sites-available/default
lrwxrwxrwx 1 root root 24 2009-03-23 14:35 websiteku -> ../sites-available/websiteku
8. Jika sudah tampak, maka sekarang lakukan perintah
root@library:/etc/apache2/sites-available#/etc/init.d/apache2 reload
* Reloading web server config apache2                                                                                        [Mon Mar 23 14:48:08 2009] [warn] VirtualHost 212.166.10.230:80 overlaps with VirtualHost 212.166.10.230:80, the first has precedence, perhaps you need a NameVirtualHost directive
[Mon Mar 23 14:48:08 2009] [warn] VirtualHost 212.166.10.230:80 overlaps with VirtualHost 212.166.10.230:80, the first has precedence, perhaps you need a NameVirtualHost directive
[Mon Mar 23 14:48:08 2009] [warn] NameVirtualHost *:80 has no VirtualHosts

9. Ternyata muncul masalah, yaitu ada error spt diatas. Saya juga sempat mengalami hal ini, hingga sekitar 5 jam. Akhirnya soluasi dari masalah ini ketemu, yaitu anda harus mengeset juga ports.conf.
10. Sekarang menuju halaman apache2 dan buka file ports.conf
root@library:/etc/apache2/sites-available#cd ..
root@library:/etc/apache2/sites-available#nano ports.conf
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
NameVirtualHost *:80
Listen 80
<IfModule mod_ssl.c>
# SSL name based virtual hosts are not yet supported, therefore no
# NameVirtualHost statement here
Listen 443
</IfModule>
11. Gantilah NameVirtualHost *:80 menjadi 212.166.10.230:80 sehingga hasilnya seperti dibawah ini
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
NameVirtualHost 212.166.10.230:80
Listen 80
<IfModule mod_ssl.c>
# SSL name based virtual hosts are not yet supported, therefore no
# NameVirtualHost statement here
Listen 443
</IfModule>
12. Lakukan penyimpanan dan lakukan kembali perintah reload apache :
root@library:/etc/apache2# /etc/init.d/apache2 reload
* Reloading web server config apache2                                                                            [ OK ]
13. Oke, proses sudah tidak ada error lagi, sub domain anda sudah berhasil
14. Sekarang buka browser dan ketikkan : http://websiteku.agungprasetyo.net pada browser anda.
Semoga Bermanfaat..

Free Template Blogger collection template Hot Deals BERITA_wongANteng SEO

0 komentar:

Posting Komentar