httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Starbuck <skij...@yahoo.com>
Subject Re: [users@httpd] Re: virtual IP based hosting with static IP?
Date Wed, 30 Jun 2004 00:17:07 GMT
Ok.  I tried your suggestion but it still doesn't
work.   My apache server insists on going to the
DocumentRoot to serve all requests for any domain so I
get the same pages no matter what domain I type in my
browser.  If I comment out the DocumentRoot, I get
"page not found" for all domains.

Here are various bits from the httpd.conf file (fake
ip's and domain names from here on down):

ServerName www.mydomain1.com:80
ServerName www.mydomain2:80

...
UseCanonicalName On

...
#
# Use name-based virtual hosting.
#
#NameVirtualHost *

#
# VirtualHost example:
# Almost any Apache directive may go into a
VirtualHost container.
# The first VirtualHost section is used for requests
without a known
# server name.
#
<VirtualHost 192.168.2.110>
    SSLEngine off
    ServerName www.mydomain1.com
    ServerAdmin mike@something.com
    DocumentRoot
/home/mike/strider/webapps/mydomain1/web
    ErrorLog
/home/mike/strider/webapps/mydomain1/logs/error.log
    TransferLog
/home/mike/strider/webapps/mydomain1/logs/transfer.log
</VirtualHost>

<VirtualHost 192.168.2.120>
    SSLEngine off
    ServerName www.mydomain2.com
    ServerAdmin mike@something.com
    DocumentRoot
/home/mike/strider/webapps/mydomain2/web
    ErrorLog
/home/mike/strider/webapps/mydomain2/logs/error.log
    TransferLog
/home/mike/strider/webapps/mydomain2/logs/transfer.log
</VirtualHost>

...
my /etc/host file:

# Do not remove the following line, or various
programs
# that require network functionality will fail.
127.0.0.1	localhost.localdomain	localhost
192.168.2.101	strider.localdomain strider
192.168.2.110   strider.mydomain1.com strider
192.168.2.120   strider.mydomain2.com strider

...
/sbin/ifconfig

eth0      Link encap:Ethernet  HWaddr
00:20:ED:91:45:F9  
          inet addr:192.168.2.101  Bcast:192.168.2.255
 Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500 
Metric:1
          RX packets:12458 errors:0 dropped:0
overruns:0 frame:0
          TX packets:13759 errors:0 dropped:0
overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:5735797 (5.4 Mb)  TX bytes:1865095
(1.7 Mb)
          Interrupt:11 Base address:0xa000 

eth0:1    Link encap:Ethernet  HWaddr
00:20:ED:91:45:F9  
          inet addr:192.168.2.110  Bcast:192.168.2.255
 Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500 
Metric:1
          RX packets:12458 errors:0 dropped:0
overruns:0 frame:0
          TX packets:13759 errors:0 dropped:0
overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:5735797 (5.4 Mb)  TX bytes:1865095
(1.7 Mb)
          Interrupt:11 Base address:0xa000 

eth0:2    Link encap:Ethernet  HWaddr
00:20:ED:91:45:F9  
          inet addr:192.168.2.120  Bcast:192.168.2.255
 Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500 
Metric:1
          RX packets:12458 errors:0 dropped:0
overruns:0 frame:0
          TX packets:13759 errors:0 dropped:0
overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:5735797 (5.4 Mb)  TX bytes:1865095
(1.7 Mb)
          Interrupt:11 Base address:0xa000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:197211 errors:0 dropped:0
overruns:0 frame:0
          TX packets:197211 errors:0 dropped:0
overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:21044410 (20.0 Mb)  TX
bytes:21044410 (20.0 Mb)

...
the output of apache access_log (notice the empty
path):

68.236.200.223 - - [29/Jun/2004:19:59:38 -0400] "GET /
HTTP/1.1" 404 285 "-" "Mozilla/5.0 (X11; U; Linux
i686; en-US; rv:1.4) Gecko/20030922"

apache error_log:

[Tue Jun 29 19:59:38 2004] [error] [client
68.236.200.223] File does not exist: /etc/httpd/htdocs


--- jeffrey_n_Dyke@Keane.com wrote:
> 
> 
> 
> >Yes. I assigned some ip aliases to the single nic
> card using ifconfig but
> I don't see how
> >apache can map to these addresses using ip-based
> virtual hosting.  I can
> how apache
> >can map to them using the domain name if i set up
> name-based hosting but
> if I use ip-based
> >hosting then the ip address of both domains will be
> the same on an
> incomming request and
> >apache will not be able to distinguish which domain
> the ip is referring
> to.
> 
> By default Apache will listen to all IPs that are on
> your server.  So if
> you have a valid IP address that you can ping, then
> you can add it to the
> httpd.conf and apache will direct traffic to that
> server for all requsts to
> that IP.  If you don't have a Virtual defined for
> that IP, apache will send
> it to the main server. Of course this method
> requires setting up DNS for
> each Domain/IP address.
> 
> >in short, i can do name-based hosting but I read
> that I can't if I want
> one of the domains to
> >process credit cards in which case I need https and
> therefore must use
> ip-based hosting.
> 
> You should easily be able to do this.  All of my
> servers are a single
> physical IP with many many virtual IPs.
> 
> I'm not sure that this will help or not, but here is
> an idea of what my
> stuff looks like.  I manage all my conf files in a
> single directory so the
> lower output is from a script that reads active
> files..so its a bit
> bastardized, but the values are what is in the
> VirtualHost and ServerName
> directives, respectively.
> 
> ifconfig -a | grep inet
>         inet 127.0.0.1 netmask ff000000
>         inet 4.11.24.49 netmask ffffff00 broadcast
> 4.19.242.255
>         inet 4.11.24.182 netmask ffffff00 broadcast
> 4.11.24.255
>         inet 4.11.24.183 netmask ffffff00 broadcast
> 4.11.24.255
>         inet 4.11.24.184 netmask ffffff00 broadcast
> 4.11.24.255
>         inet 4.11.24.185 netmask ffffff00 broadcast
> 4.11.24.255
>         inet 4.11.24.186 netmask ffffff00 broadcast
> 4.11.24.255
>         inet 4.11.24.187 netmask ffffff00 broadcast
> 4.11.24.255
>         inet 4.11.24.188 netmask ffffff00 broadcast
> 4.11.24.255
>         inet 4.11.24.189 netmask ffffff00 broadcast
> 4.11.24.255
>         inet 4.11.24.190 netmask ffffff00 broadcast
> 4.11.24.255
>         inet 4.11.24.191 netmask ffffff00 broadcast
> 4.11.24.255
>         inet 4.11.24.193 netmask ffffff00 broadcast
> 4.11.24.255
> 
> Virtual Host      ServerName
> 4.11.24.185       dns1.domain.com
> 4.11.24.186       dns2.domain.com
> 4.11.24.183       dns3.domain.com
> 4.11.24.184       dns4.domain.com
> 4.11.24.190       dns5.domain.com
> 4.11.24.182       dns6.domain.com
> 4.11.24.188       dns7.domain.com
> 4.11.24.191       dns8.domain.com
> 4.11.24.189       dns9.domain.com
> 4.11.24.187       dns10.domain.com
> 4.11.24.193       dns11.domain.com
> 
> names/ips are changed to protect the innocent.(and
> my job)
> 
> 
> 
> 
> 
> 
> 
> 
>
---------------------------------------------------------------------
> The official User-To-User support forum of the
> Apache HTTP Server Project.
> See for more info.
> To unsubscribe, e-mail:
> users-unsubscribe@httpd.apache.org
> " from the digest:
> users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail:
> users-help@httpd.apache.org
> 
> 
> 
> --
> 
> The information contained in this email along with
> all attachments is
> confidential and is not to be shared without my
> permission and prior
> knowledge of who will be viewing it's contents
> including all attachments.
> 
> 
> Do you Yahoo!?
> New and Improved Yahoo! Mail - 100MB free storage!
> 
> 
> 
> 
> 
> 
> 
> 
> 
>
---------------------------------------------------------------------
> The official User-To-User support forum of the
> Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for
> more info.
> To unsubscribe, e-mail:
> users-unsubscribe@httpd.apache.org
>    "   from the digest:
> users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail:
> users-help@httpd.apache.org
> 
> 


=====
-- 

The information contained in this email along with all attachments is confidential and is
not to be shared without my permission and prior knowledge of who will be viewing it's contents
including all attachments.


		
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message