Tuesday, September 20, 2011

DNS and Web Server with Debian

Setting  your ip with command #nano /etc/network/interfaces

Allow-hotplug eth0
iface eth0 inet static
address 192.168.10.24
netmask 255.255.255.240
network 192.168.10.16
broadcast 192.168.10.31
gateway 192.168.10.24

Activated ip forward with command #nano /etc/sysctl.conf
Find #net.ipv4.ip_forward=1
delete '#' 
Then  restart interfaces with command #/etc/init.d/networking restart
After that, edit file #nano /etc/resolv.conf


Search badx.net
Nameserver 192.168.10.24

DNS configuration. Install packet bind with command #apt-get install bind9
Edit file /etc/bind/named.conf with command #nano /etc/bind/named.conf
add this at the last paragraph :
Zone “badx.net” {
Type master;
File “/etc/bind/db.badx”;
};

Zone “10.168.192.in-addr.arpa” {
Type master;
File “/etc/bind/db.badx”;
};


Create a database
#nano /etc/bind/db.badx
@ IN SOA badx.net. root.badx.net (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS badx.net.
@ IN A 192.168.10.24
@ IN AAAA ::1
www IN CNAME @
example IN CNAME @

and

@ IN SOA badx.net. root.badx.net (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS badx.net.
www IN CNAME @
jurusan IN CNAME @
24 IN PTR @

Restart bind with command  #/etc/init.d/bind9 restart
Check with command  #nslookup
>badx.net 



>192.168.10.24


Webserver Configuration

o install apache with command  #apt-get install apache2
o install apache with command  #apt-get install php5
o Create folder with command  mkdir /home/ichsan/myfolder
o Create file index.php in thats folder

o Create folder mkdir /home/ichsan/test
o Create file index.php in thats Folder
o edit file /etc/apache2/sites-available/default


add this :

<Virtualhost *:80>
Serveradmin ichsan@badx.net
Servername badx.net
Serveralias www.badx.net
Documentroot /home/ichsan/myfoder
</Virtualhost >

<Virtualhost *:80>
Serveradmin ichsan@badx.net
Servername  jurusan.badx.net
Documentroot /home/ichsan/test
</Virtualhost >

restart apache with command  #/etc/init.d/apache2 restart

Finish :). So easy

0 comments:

Post a Comment