Instalasi Virtualhost (subDomain)

SubDomain
Hasil gambar untuk subdomain



Pengertian
Subdomain adalah bagian dari sebuah nama domain induk. Subdomain umumnya mengacu ke suatu alamat fisik di sebuah situs contohnya: wikipedia.org merupakan sebuah domain induk. Sedangkan id.wikipedia.org merupakan sebuah sub domain. Biasanya, subdomain ada di depan domain dan dipisah dengan titik, seperti id.wikipedia.org. id merupakan subdomain wikipedia, sedangkan wikipedia itu sendiri adalah domain induk. Subdomain juga sebagai Third level domain.

latarbelakang
 latarbelakang saya menginstal sub domain adalah untuk membuat sub dari domain utama server saya

maksud & tujuan
 tujuan saya menginstal sub domain adalah untuk membuat sub atau bagian dari domain induk

waktu
 15 menit

langkah-langkah
1.Buat Isi Konten Subdomain
 

- Buat sebuah folder dan file index untuk isi konten sub domain seperti portal

mkdir /var/www/html/subdomain
- Lalu edit index.html

nano /var/www/html/subdomain/index.html
 Saya tambahkan script berikut

<html>
<head>
<title>
portal
</title>
</head>
<body>
<marquee>sub domain</marquee><h1>portal.smkjogsa.id</h1>
</body>
</html>


2. Konfigurasi Virtualhost
 

- Pindah directory

# cd /etc/apache2/sites-available/
- Masukan perintah

#  cp 000-default.conf subdomain.conf
 - Lalu edit file subdomain.conf

#  nano subdomain.conf
Ganti dan tambahkan beberapa baris konfigurasi seperi dibawah ini

<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 smkjogsa.id
        ServerAlias sub.smkjogsa.id

        DocumentRoot /var/www/html/subdomain

        # 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 info 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>  


- Lalu aktifkan perintah untuk mengaktifkan site tersebut
# a2ensite  subdomain.conf
- Kemudian restart apache2

# /etc/init.d/apache2 restart
4. testing




kesimpulan
 jadi, kesimpulannya kita dapat mengetahui cara membuat sub domain dari domain utama kita

referensi
-http://tataufiku.blogspot.co.id/2015/08/konfigurasi-virtualhost-subdomain-pada.html

0 comments:

Subscribe