Mengembangkan web tidak hanya selalu berkaitan dengan teknis. Kadang menggunakan `environment` tertentu dapat membuat kita lebih nyaman dalam mengembangkan web. Selain nyaman, `environment` tersebut pun harus ditinjau juga dari lisensinya, apakah berbayar atau gratis. Bagi yang beruntung nasibnya, bisa memperoleh `environment` tersebut dengan OS yang berbayar tapi bagi yang tidak beruntung nasibnya mau nggak mau harus mencari alternatif yang lain tentunya seperti memakai OS yang gratisan.
Di sini saya ingin berbagi bagaimana caranya mempersiapkan `environment` pengembangan web dengan OS Linux Ubuntu yang gratis.
Langkah-langkahnya adalah sebagai berikut:
1. Ubah DNS local. Letaknya ada di /etc/hosts.
2. Tambahkan VNIC (Virtual Network Interface Card).
3. Ubah file konfigurasi virtual host di Apachenya. Letak file konfigurasi virtual hostnya ada di folder_apache/etc/extra/httpd-vhosts.conf. (Atau mungkin berbeda di apache Anda)
4. Restart Apache.
5. (opsional) Tambahkan VNIC agar di-load setiap kali start-up.
1. Ubah DNS Local.
Buka file /etc/hosts. Buka file tersebut dan tambahkan IP dan nama domain dengan yang kita inginkan
Code: Select all
127.0.0.1 localhost.localdomain localhost
::1 your-host localhost6.localdomain6 localhost6
127.0.1.1 your-host
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
192.168.1.19 opencartguwe.com www.opencartguwe.com
Bayangkan saja ada sebuah Ethernet Card atau semacamnya yang dipasangkan di komputer kita tapi virtual. Mantap to' ??
Caranya sangat mudah, yaitu tinggal menambahkan ': (titik dua)' diikuti nomor virtual di belakang NICnya, seperti berikut ini:
Code: Select all
your-name@your-host:-$ sudo ifconfig eth0:9 192.168.1.19 netmask 255.255.255.0
Code: Select all
your-name@your-host:-$ ping 192.168.1.19
Code: Select all
your-name@your-host:-$ ping opencartguwe.com
PING opencartguwe.com (192.168.1.19) 56(84) bytes of data.
64 bytes from opencartguwe.com (192.168.1.19): icmp_req=1 ttl=64 time=0.022 ms
64 bytes from opencartguwe.com (192.168.1.19): icmp_req=2 ttl=64 time=0.047 ms
^C
--- opencartguwe.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.022/0.034/0.047/0.013 ms
Apache memerlukan informasi untuk mengetahui di mana letak document root dan domain name apa yang menjadi domain name si document root tersebut. Letak file konfigurasinya ada di /etc/apache/extra/httpd-vhosts.conf. Letak file ini bisa berbeda di setiap komputer. Contohnya seperti ini:
Code: Select all
<VirtualHost 192.168.1.19:80>
ServerAdmin webmaster@opencartguwe.com
DocumentRoot "/home/gangsar/opencart"
ServerName opencartguwe.com
ServerAlias www.opencartguwe.com
ErrorLog "logs/opencartguwe.com-error_log"
CustomLog "logs/opencartguwe.com-access_log" common
<Directory "/home/gangsar/opencart">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/trunk/mod/core.html#options
# for more information.
#
#Options Indexes FollowSymLinks
# XAMPP
Options Indexes FollowSymLinks ExecCGI Includes
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
#AllowOverride None
# since XAMPP 1.4:
AllowOverride All
#
# Controls who can get stuff from this server.
#
Require all granted
</Directory>
</VirtualHost>
Code: Select all
### Periksa di file httpd.conf Anda ###
# Load vhost module
LoadModule vhost_alias_module modules/mod_vhost_alias.so
#dan
# Virtual hosts
Include etc/extra/httpd-vhosts.conf
Langkah yang terakhir adalah restart Apache-nya. Caranya bisa berbeda di tiap-tiap komputer.
Code: Select all
your-name@your-host:~$ sudo /opt/lampp/lampp restart
Stopping XAMPP for Linux 1.8.0...
XAMPP: Stopping Apache with SSL...
XAMPP: Stopping MySQL...
XAMPP: Stopping ProFTPD...
XAMPP stopped.
Starting XAMPP for Linux 1.8.0...
XAMPP: Starting Apache with SSL (and PHP5)...
XAMPP: Starting MySQL...
XAMPP: Starting ProFTPD...
XAMPP for Linux started.
Silahkan buka http://opencartguwe.com atau http://www.opencartguwe.com
Selamat berjuang, membuat proyek web Anda! Ganbatte!!! Fighting!!! Semangat!!!
Semoga berhasil dengan proyek web Anda.
5. (opsional) Tambahkan sebagai service yang di-load setiap kali start-up.
Langkah ini hanya opsional saja. Tujuannya hanya agar Kita tidak selalu repot menambahkan VNIC setiap kali ingin mengembangkan proyek web Kita.
Caranya adalah bisa dengan memodifikasi file /etc/network/interfaces
Code: Select all
auto lo
iface lo inet loopback
auto eth0:2
iface eth0:2 inet static
address 192.168.1.5
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
auto eth0:1
iface eth0:1 inet static
address 192.168.1.7
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
# bisa ditambahkan di sini #
auto eth0:9
iface eth0:9 inet static
address 192.168.1.19
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
Ada tutorial yang lebih bagus lagi di http://erwan.blogsome.com/2010/04/15/vi ... buntu-910/, http://ubuntu-tutorials.com/2008/01/09/ ... l-hosting/, atau di http://www.ubuntugeek.com/howto-create- ... pache.html.
Versi pdf tutorial ini bisa di-download di sini https://docs.google.com/uc?export=downl ... zVHclYwSTQ