Saturday, July 21, 2007

how to set a virtual host directory in apache2

open your terminal konsole

create a directory

unos@xoxo:~$ mkdir virtual

define your host for the directory

unos@xoxo:~$ sudo nano /etc/hosts
127.0.0.1 localhost
127.0.0.2 virtual

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

define your virtual path in the apache httpd.conf

unos@xoxo:~$ sudo nano /etc/apache2/httpd.conf
NameVirtualHost 127.0.0.2:80

"<"VirtualHost 127.0.0.2:80">"
ServerName virtual
DocumentRoot /home/unos/virtual
"<"Directory /home/unos/virtual">"
AllowOverride All
Options Indexes SymLinksIfOwnerMatch IncludesNoExec
"<"/Directory">"
"<"/VirtualHost">"

then restart your apache2

unos@xoxo:~$ sudo /etc/init.d/apache2 restart

open your browser and just type virtual and it will direct you to your site
till then :">

notes:please ignore the double-quote..im putting it there because blogspot does not recognize < symbol

ubuntu how to connect to internet using dhclient

open your terminal konsole
check if there is a wifi connection

unos@xoxo:~$ sudo iwlist eth1 scanning
eth1 Scan completed :
Cell 01 - Address: 00:60:B3:5A:BB:F0
ESSID:"streamyx"
Protocol:IEEE 802.11bg
Mode:Master
Channel:1
Encryption key:on
Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 6 Mb/s; 9 Mb/s
11 Mb/s; 12 Mb/s; 18 Mb/s; 22 Mb/s; 24 Mb/s
36 Mb/s; 48 Mb/s; 54 Mb/s
Quality=78/100 Signal level=-47 dBm
Extra: Last beacon: 240ms ago

Then...connect to the network

unos@xoxo:~$ sudo iwconfig eth1 essid streamyx key "123456789"
unos@xoxo:~$ sudo iwconfig eth1
eth1 IEEE 802.11g ESSID:"streamyx"
Mode:Managed Frequency:2.412 GHz Access Point: 00:60:B3:5A:BB:F0
Bit Rate:36 Mb/s Tx-Power=20 dBm Sensitivity=8/0
Retry limit:7 RTS thr:off Fragment thr:off
Encryption key:0123-4567-89 Security mode:open
Power Management:off
Link Quality=80/100 Signal level=-49 dBm Noise level=-89 dBm
Rx invalid nwid:0 Rx invalid crypt:78 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:1

then use dhclient to connect to the network

unos@xoxo:~$ sudo dhclient eth1
There is already a pid file /var/run/dhclient.pid with pid 9721
killed old client process, removed PID file
Internet Systems Consortium DHCP Client V3.0.4
Copyright 2004-2006 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/

Listening on LPF/eth1/00:0e:35:ce:cf:b2
Sending on LPF/eth1/00:0e:35:ce:cf:b2
Sending on Socket/fallback
DHCPREQUEST on eth1 to 255.255.255.255 port 67
DHCPACK from 192.168.1.1
bound to 192.168.1.34 -- renewal in 1708 seconds.

to check the nameserver of the connection

unos@xoxo:~$ sudo cat /etc/resolv.conf
nameserver 192.168.1.1
nameserver 192.168.1.1

to check the connection to the internet

unos@xoxo:~$ ping www.google.com -c 3
PING www.l.google.com (64.233.189.104) 56(84) bytes of data.
64 bytes from www.google.com (64.233.189.104): icmp_seq=1 ttl=244 time=58.0 ms
64 bytes from www.google.com (64.233.189.104): icmp_seq=2 ttl=244 time=59.3 ms
64 bytes from www.google.com (64.233.189.104): icmp_seq=3 ttl=244 time=58.2 ms

--- www.l.google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 58.002/58.512/59.308/0.634 ms

and you are connected (^_^)