.

.

Membuat Sub Domain Dengan Virtual Host di Ubuntu

Posted by swilsarblog Tuesday, November 24, 2009

Langkah ini dijalankan dengan tujuan untuk membuat sub domain dari website awal yang sudah kita miliki.

1. pertama-tama, buatlah folder untuk menampung file-file html yang nantinya akan diupload.

root@library:~#mkdir /var/www/cobaweb

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#vim cobaweb

4. Tambahkan isi file berikut :

ServerAdmin admin@bebas.web.id
ServerName cobaweb.bebas.web.id
ServerAlias cobaweb.bebas.web.id
DocumentRoot /var/www/cobaweb
ErrorLog /var/log/apache2/error-cobaweb.log
CustomLog /var/log/apache2/access-cobaweb.log combined


Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

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 cobaweb
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-04-22 11:39 000-default -> ../sites-available/default
lrwxrwxrwx 1 root root 24 2009-04-22 14:35 cobaweb -> ../sites-available/cobaweb

8. Jika sudah tampak, maka sekarang lakukan perintah

root@library:/etc/apache2/sites-available#/etc/init.d/apache2 reload
* Reloading web server config apache2 [Wed Apr 22 14:48:08 2009] [warn] VirtualHost 202.xxx.xxx.xxx:80 overlaps with VirtualHost 202.xxx.xxx.xxx:80, the first has precedence, perhaps you need a NameVirtualHost directive
[Mon Apr 22 14:48:08 2009] [warn] VirtualHost 202.xxx.xxx.xxx:80 overlaps with VirtualHost 202.xxx.xxx.xxx:80, the first has precedence, perhaps you need a NameVirtualHost directive
[Mon Apr 22 14:48:08 2009] [warn] NameVirtualHost *:80 has no VirtualHosts

9. Jika pesan seperti diatas muncul maka lakukan editing pada file ports.conf

10. Sekarang menuju halaman apache2 dan buka file ports.conf

root@library:/etc/apache2/#vim 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


# SSL name based virtual hosts are not yet supported, therefore no
# NameVirtualHost statement here
Listen 443

11. Gantilah NameVirtualHost *:80 menjadi 202.xxx.xxx.xxx: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 202.xxx.xxx.xxx:80
Listen 80


# SSL name based virtual hosts are not yet supported, therefore no
# NameVirtualHost statement here
Listen 443

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://cobaweb.bebas.web.id pada browser anda.

Good Luck…



Related Post About This Category :


1 Responses to Membuat Sub Domain Dengan Virtual Host di Ubuntu

  1. bocah dablek Says:
  2. hallloo mas wilsar..
    saya mau tanya nih..
    saya ingin buat subdomain di ubuntu 8.10
    saya ikutin langkah2 diatas..
    tetapi setelah melakukan perintah ini:

    root@library:/etc/apache2/sites-available#a2ensite cobaweb
    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/
    disini hasilnya pasti fail terus...
    mohon bantuannya...
    terimakasih...

    www.masnyoto.com
    ym bocah_dablek@yahoo.com

     

Post a Comment