Virtual IP and folder redirection

First we need to configure static IP in ubuntu system.

# vim /etc/network/interfaces

Main IP system IP

auto eth0

iface eth0 inet static
address 192.168.1.92
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4

Virtual IP
auto eth0:1                  
iface eth0:1 inet static
address 192.168.1.93
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255

:wq

#sudo /etc/init.d/networking restart

# ifconfig (you can see both IPs)

#ping from other system it will work.

Folder redirection

# vim /etc/apache2/httpd.conf

<Virtualhost 192.168.1.92:80>
Servername 192.168.1.92
Serveralias ami.org
Documentroot /var/www
</virtualhost>

<VirtualHost 192.168.1.93:80>

DocumentRoot /var/www/wordpress

ServerName 192.168.1.93/

Serveralias ami.in
</VirtualHost>

# sudo /etc/init.d/apache2 restart

Go to web browser and see .It will work

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s