Hi all,
I'm trying to setup two different websites with two different certificates on my Linode (Ubuntu 10.04LTS).
To do this on Tomcat, I need two different IP addresses.
However, currently, all HTTP requests are going to the same IP address, even if you enter a different IP address in the browser:
http://178.79.152.69/test.jsphttp://176.58.107.88/test.jspThe code for test.jsp:
Code:
<p>Java Version:<%= System.getProperty( "java.version" ) %>
<p>Local name:<%= request.getLocalName() %>
<p>Server name:<%= request.getServerName() %>
<p>Local IP:<%= request.getLocalAddr() %>
Any idea how to troubleshoot? I'm a networking newbie, so don't even know at what point the HTTP request header would get the target IP address and name added to it, + have no idea where to start in trying to figure this out.
I've setup the two IP addresses in /etc/network/interfaces:
Code:
# The loopback interface
auto lo
iface lo inet loopback
# Configuration for eth0 and aliases
# This line ensures that the interface will be brought up during boot.
auto eth0 eth0:0
#iface eth0 inet dhcp
# eth0 - This is the main IP address that will be used for most outbound connections.
# The address, netmask and gateway are all necessary
iface eth0 inet static
address 178.79.152.69
netmask 255.255.255.0
gateway 178.79.152.1
pre-up iptables-restore < /etc/iptables.conf
# eth0:0
# This is a second public IP address.
iface eth0:0 inet static
address 176.58.107.88
netmask 255.255.255.0
pre-up iptables-restore < /etc/iptables.conf
I've also setup the hosts file to point each IP at the correct domain:
Code:
127.0.0.1 localhost.localdomain localhost
178.79.152.69 www.joli-ciel.com bilbo.joli-ciel.com bilbo.aplikaterm.com www.aplikaterm.com joli-ciel.com bilbo
176.58.107.88 www.moyshele.com www.flyingpencil.com moyshele.com flyingpencil.com moyshele
# 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
ifconfig gives the following:
Code:
eth0 Link encap:Ethernet HWaddr fe:fd:b0:3a:6b:58
inet addr:178.79.152.69 Bcast:178.79.152.255 Mask:255.255.255.0
inet6 addr: fe80::fcfd:b0ff:fe3a:6b58/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:492 errors:0 dropped:0 overruns:0 frame:0
TX packets:459 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:54167 (54.1 KB) TX bytes:298402 (298.4 KB)
Interrupt:44
eth0:0 Link encap:Ethernet HWaddr fe:fd:b0:3a:6b:58
inet addr:176.58.107.88 Bcast:176.58.107.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:44
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:6178 errors:0 dropped:0 overruns:0 frame:0
TX packets:6178 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1089074 (1.0 MB) TX bytes:1089074 (1.0 MB)
Rgds,
Assaf