Monday 23 April 2018

Cara Membuat Web Server Di Virtual-Box



Assalamualaikum Wr.Wb.
Kembali lagi bersama HasanDesign, Yang akan selalu membuat hari anda tersenyum (preeet)
Oke .. Apakah anda sudah tersenyum ?(Belummmm)
Hahaha (Kenapa loe yang tersenyum) Gpp
Oke .. Jangan bercanda lagi karena bercanda itu memberi beberapa Umur (hehhee)



Oke .. kali ini admin akan membagikan cara bagaimana membuat web server di debian.
Dimana kegunaan web server ini adalah untuk membuat penyimpanan via web
Jadi nantinya akan dapat diakses lewat Website yang kita buat sendiri
Dengan melalui jaringan di PC kita . Jadi kalau ada yang terhubung dengan pc kita, maka mereka bisa mengakses web server kita.
Oke langsung saja Untuk bahan-bahan nya sebagai berikut :
1. Aplikasi Virtual-Box
2. File Virtual-Box instalasi debian 8.3
3. Aplikasi Winscp DISINI

Oke sekarang simak baik-baik Tutorial nya
1. Buka aplikasi Virtual-Box
2. Mulai(Start) bahan nomor 2
3. Masuk kan untuk login dan password nya
login as: root
root@192.168.43.11's password:

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Apr 23 07:04:17 2018
root@server:~#
4. Masukkan perintah dibawah untuk mengubah ip jaringan PC anda
root@server:~# nano /etc/network/interfaces
5. Masukkan data dibawah sesuai keinginan anda
auto eth0
iface eth0 inet static
        address 192.168.43.11
        netmask 255.255.255.0
        gateway 192.168.43.1
Sehingga menjadi seperti ini
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address 192.168.43.11
        netmask 255.255.255.0
        gateway 192.168.43.1
Tekan Kominasi keyboard dibawah untuk menyimpan
Simpan (CTRL+O)
Dan       (Enter)
Keluar   (CTRL+X)
6. Masuk kan perintah dibawah untuk Service / restart Settingan anda
root@server:~# service networking restart
7. Sambungkan Debian Server kita ke Debian Reposytory, Karena disini saya menggunakan Debian Reposytory.
Tutorial Debian Reposytory dapat dilihat DISINI
Perintah Untuk menyambungkan
root@server:~# nano /etc/apt/sources.list
Tambahkan text dibawah ini
deb http://192.168.43.52/debian jessie main
deb-src http://192.168.43.52/debian jessie main
Sehingga menjadi seperti
# deb cdrom:[Debian GNU/Linux 8.3.0 _Jessie_ - Official i386 DVD Binary-1 20160$

#deb cdrom:[Debian GNU/Linux 8.3.0 _Jessie_ - Official i386 DVD Binary-1 201601$

deb http://192.168.43.52/debian jessie main
deb-src http://192.168.43.52/debian jessie main

# Line commented out by installer because it failed to verify:
#deb http://security.debian.org/ jessie/updates main contrib
# Line commented out by installer because it failed to verify:
#deb-src http://security.debian.org/ jessie/updates main contrib

# jessie-updates, previously known as 'volatile'
# A network mirror was not selected during install. The following entries
# are provided as examples, but you should amend them as appropriate
# for your mirror of choice.
#
8. Ketik perintah dibawah untuk proses terakhir dari penyambungan debian ke reposytory
root@server:~# apt-get update
9. Install paket-paket yang dibutuhkan
root@server:~# apt-get install bind9 apache2
10. SETTING DNS SERVER
Masuk ke /etc/bind dengan cara ketik perintah dibawah
root@server:~# cd /etc/bind
11. Edit file named.conf
root@server:/etc/bind# nano named.conf
12. Tambah kan Tulisan dibawah ini, ditengah-tengah isi dari file named.conf
zone "tkjsmart.com" {
              type master;
              file "/etc/bind/db.tkj";
};

zone "192.in-addr.arpa" {
              type master;
              file "/etc/bind/db.192";
};
Sehingga menjadi seperti dibawah ini
// This is the primary configuration file for the BIND DNS server named.
//
// Please read /usr/share/doc/bind9/README.Debian.gz for information on$
// structure of BIND configuration files in Debian, *BEFORE* you custom$
// this configuration file.
//
// If you are just adding zones, please do that in /etc/bind/named.conf$

zone "tkjsmart.com" {
              type master;
              file "/etc/bind/db.tkj";
};

zone "192.in-addr.arpa" {
              type master;
              file "/etc/bind/db.192";
};

include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";
Tekan tombol dibawah untuk menyimpan dan keluar
Simpan (CTRL+O)
Dan       (Enter)
Keluar   (CTRL+X)
13. Copy db.local ke db.tkj
root@server:/etc/bind# cp db.local db.tkj
14. Copy juga db.127 db.192
root@server:/etc/bind# cp db.127 db.192
15. Edit file db.tkj
root@server:/etc/bind# nano db.tkj
16. Tambah kan yang belum ada sehingga menjadi seperti dibawah ini
;
; BIND data file for local loopback interface
;
$TTL          604800
@     IN       SOA       tkjsmart.com. root.tkjsmart.com. (
                         2             ; Serial
                         604800        ; Refresh
                         86400         ; Retry
                         2419200       ; Expire
                         604800 )      ; Negative Cache TTL

;
@     IN       NS            tkjsmart.com.
@     IN       A             192.168.43.11
www   IN       A             192.168.43.11
Tekan tombol dibawah untuk menyimpan dan keluar
Simpan (CTRL+O)
Dan       (Enter)
Keluar   (CTRL+X)
17. Edit juga file db.192 dengan perintah dibawah
root@server:/etc/bind# nano db.192
18. Masuk kan didalam nya agar menjadi seperti dibawah ini
;
; BIND reverse data file for local loopback interface
;
$TTL           604800
@     IN        SOA           tkjsmart.com. root.tkjsmart.com. (
                              1            ; Serial
                              604800       ; Refresh
                              86400        ; Retry
                              2419200      ; Expire
                              604800 )     ; Negative Cache TTL

;
@                   IN        NS            tkjsmart.com.
192.168.43.11       IN        PTR           tkjsmart.com.
192.168.43.11       IN        PTR           www.tkjsmart.com.
Tekan tombol dibawah untuk menyimpan dan keluar
Simpan (CTRL+O)
Dan       (Enter)
Keluar   (CTRL+X)
19. Ketikan perintah dibawah untuk mengedit file resolv.conf
root@server:/etc/bind# nano /etc/resolv.conf
Tambahkan didalam nya tulisan dibawah ini
nameserver 192.168.43.11
search tkjsmart.com
Tekan tombol dibawah untuk menyimpan dan keluar
Simpan (CTRL+O)
Dan       (Enter)
Keluar   (CTRL+X)
20. Ketik kan tombol dibawah untuk merestart apa yang sudah kita setting di /etc/bind
root@server:/etc/bind# rndc reload


Dan jika hasil nya seperti dibawah ini berarti settingan anda berhasil
server reload successful
21. Ketik kan perintah dibawah untuk mengcek apakah sudah bisa diakses DNS yang kita buat
root@server:/etc/bind# nslookup cloud.tkjsmart.com


Jika sudah seperti dibawah ini berarti DNS anda berhasil
Server: 192.168.43.11
Address: 192.168.43.11#53

Name: cloud.tkjsmart.com
Address: 192.168.43.11
22. Sekarang coba ping ke cloud.tkjsmart.com, dengan perintah dibawah ini
root@server:/etc/bind# ping cloud.tkjsmart.com
PING cloud.tkjsmart.com (192.168.43.11) 56(84) bytes of data.
64 bytes from 192.168.43.11: icmp_seq=1 ttl=64 time=0.128 ms
64 bytes from 192.168.43.11: icmp_seq=2 ttl=64 time=0.045 ms
64 bytes from 192.168.43.11: icmp_seq=3 ttl=64 time=0.045 ms
64 bytes from 192.168.43.11: icmp_seq=4 ttl=64 time=0.045 ms

23. Masuk ke directory apache2 dengan perintah
root@server:/etc/bind# cd /etc/apache2/sites-available/
24. Copy file 000-default.conf menjadi tkj.conf
root@server:/etc/apache2/sites-available# cp 000-default.conf tkj.conf
25. Edit file tkj.conf, Dengan perintah dibawah ini
root@server:/etc/apache2/sites-available# nano tkj.conf
26. Masuk kan text berikut
ServerAdmin hasan@tkjsmart.com
ServerName www.tkjsmart.com
ServerAlias tkjsmart.com
DocumentRoot /var/www/tkj
Sehingga menjadi seperti dibawah ini
# The ServerName directive sets the request scheme, hostname an$
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the Server$
# specifies what hostname must appear in the request's Host: he$
# match this virtual host. For the default virtual host (this f$
# value is not decisive as it is used as a last resort host reg$
# However, you must set it for any further virtual host explici$
#ServerName www.example.com

ServerAdmin hasan@tkjsmart.com
ServerName www.tkjsmart.com
ServerAlias tkjsmart.com
DocumentRoot /var/www/tkj

# Available loglevels: trace8, ..., trace1, debug, info, notice$
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
Tekan tombol dibawah untuk menyimpan dan keluar
Simpan (CTRL+O)
Dan      (Enter)
Keluar  (CTRL+X)
27. Mulai tkj.conf dengan perintah dibawah
root@server:/etc/apache2/sites-available# a2ensite tkj.conf
Enabling site tkj.
To activate the new configuration, you need to run:
   service apache2 reload
28. Masuk kan perintah dibawah untuk menservice apache2
root@server:/etc/apache2/sites-available# service apache2 reload
29. Hentikan 000-default.conf dengan perintah dibawah ini
root@server:/etc/apache2/sites-available# a2dissite 000-default.conf
Site 000-default disabled.
To activate the new configuration, you need to run:
   service apache2 reload
30. Lalu service apache2 nya
root@server:/etc/apache2/sites-available# service apache2 reload 
31. Sekarang buat SSH nya (Untuk jembatan pengiriman file ke WEB Server)
32. Install SSH
root@server:~# apt-get install openssh.*
33. Setting SSH
root@server:~# nano /etc/ssh/sshd_config
34. Geser kebawah dan Ubah Permit root login menjadi yes seperti ini
# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes
Tekan Kominasi keyboard dibawah untuk menyimpan
Simpan (CTRL+O)
Dan       (Enter)
Keluar   (CTRL+X)
35. Service SSH
root@server:~# service ssh restart
36. Buat Folder untuk file html dan isinya
root@server:~# mkdir /var/www/tkj
37. Oke untuk settingan nya sudah selesai, sekarang siapkan file html yang sudah anda buat . Atau bisa cari di google .. Contoh nya 

38. Copy file diatas ke Web Server dengan aplikasi WINSCP . Buka WINSCP, Maka tampilan nya akan seperti ini

39. Masuk ke folder /var/www/tkj di WINSCP

40. Lalu Seret File html ke folder Tersebut, Maka file akan masuk ke web server


41. Dan untuk percobaan nya bisa anda lakukan di web browser (CHROME) atau yang sejenis nya. Dan bisa menggunakan IP address nya 192.168.43.11 atau DNS nya www.tkjsmart.com
Maka Tampilan nya akan seperti ini

IP ADDRESS

Untuk DNS harus mengubah IP PC terlebih dahulu seperti Ini








Oke sekian postingan kali ini mohon maaf jika ada kesalahan. Kalau ada masalah harap beri komentar di kolom komentar .

Oke Sampai jumpa dipostingan admin selanjutnya .
Wassalamualaikum Wr.Wb.