Home » , » Konfigurasi Virtualhost (Subdomain) Pada Debian Server 8

Konfigurasi Virtualhost (Subdomain) Pada Debian Server 8



    Halo teman pada kesempatan kali ini aku akan sharing bgaimana cara konfigurasi virtual host atau sub domain di Debian server. slain domain utama semisal hudaonline.net, masih sanggup kita tambahkan lagi sub domain dari domain utama tersebut Sehingga kita lebih menghemat Ip Address dan juga domain.
Contoh subdomain adalah, mail.yahoo.com dan mail.google.com. Kata mail pada domain tersebutlah yang dinamakan “sub” domain

Langkah langkah Konfigurasi :

Pertama, buatlah sebuah folder dan file index untuk isi konten sub domain menyerupai portal yaitu saya  menciptakan folder /var/www aku menciptakan folder dengan nama portal dengan perintah :

#mkdir portal

kemudian buatlah file index dengan perintah :

#nano var/www/portal/index.html

Lalu tambahkan code menyerupai dibawah ini :


Kemudian simpan dan keluar , atau dengan ctrl+X kemudian y kemudian enter. Kemudian anda berpindah directori untuk memulai konfigurasi virtual host dengan perintah :

#cd /etc/apache2/sites-available/

Anda pindah ke direktori sited available, untuk mempermudah konfigurasi silahkan anda salin file default ke nama sub domain menyerupai portal dengan perintah :

#cp default portal

sehabis anda salin editlah file portal dengan perintah :

#nano portal

Ganti dan tambahkan beberapa baris konfigurasi menyerupai di bawah ini atau anda sanggup mengikuti gambar :

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin admin@tataufik.com
        ServerName hudaonline.net
        ServerAlias portal.hudaonline.net

        DocumentRoot /var/www/portal

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel warta ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>




Keterangan :
ServerName = Nama domain
ServerAlias = Nama subdomain yang ingin dialihkan/dijadikan virtual alias.
ServerAdmin = Alamat email pemilik domain.
DocumentRoot = Tempat pengalihan direktori dari Virtual Alias yang dibuat.

Setelah anda konfigurasi masukkan perintah di bawah ini :

#a2ensite portal

kemudian masukkan lah perintah :

#service apache2 force-reload

sehabis itu coba buka browser dan ketikkan http://ipadd/portal kalau berhasil akan muncul web menyerupai gambar berikut :


kalau anda masih belum berhasil coba ketikkan "service apache2 restart" atau periksa lagi konfigurasi anda . sekian tips dari aku biar postingan ini bermanfaat dan kalau ada saran,kritik atau pertanyaan silahkan komentar terimakasih .

0 comments:

Post a Comment

Search

Blog Archive