Cài đặt bind
sudo apt-get install bind9
Thiết lập BIND như là 1 caching server. Có nghĩa là card mạng dùng DNS của BIND dùng DNS của public của DNS nào đó nếu muốn internet
Mở:
/etc/bind/named.conf.options
Thiết lập:
forwarders {
# Phía dưới dùng google DNS. Bạn có thể dùng DNS khác
8.8.8.8;
8.8.4.4;
};
Tạo 1 ZONE
Mở:
/etc/bind/named.conf.local
Thêm 1 zone:
zone "dev.com" {
type master;
file "/etc/bind/db.dev.com";
};
Tạo:
/etc/bind/db.dev.com
Thêm vào:
;
; BIND data file for local loopback interface
;
$TTL 14400
@ IN SOA dev.com. root.dev.com. (
2012091901 ; Serial
86400 ; Refresh
7200 ; Retry
3600000 ; Expire
86400 ) ; Negative Cache TTL
;
@ IN NS dev.com.
@ IN A 127.0.0.1
* IN A 127.0.0.1
@ IN AAAA ::1
Khởi động lại BIND
sudo service bind9 restart
Bước tiếp theo là thiết lập card mạng chúng ta dùng DNS 127.0.0.1
Please google!
Kết tiếp là thiết lập Apache (tạo virtual host) cho tên miền dev.com
<Virtualhost *:80> ServerName dev.com ServerAlias *.dev.com DocumentRoot /home/user/www/dev.com <directory "/home/user/www/dev.com"> AllowOverride All Options All Order allow,deny Allow from all </Directory> ErrorLog /var/log/apache2/dev.com.error.log CustomLog /var/log/apache2/dev.com.access.log combined </VirtualHost>