Apache Virtual Server [SOLVED]

Dennis Kaptain dkaptain at yahoo.com.mx
Thu Apr 30 13:42:26 UTC 2009


> >

> >  I am playing with the Zend Framework on my laptop. In my reading of
> > Zend documentation it looks like Zend wants a certain directory structure
> > so I created:
> > /var/www/html/QuickStart/
> > /var/www/html/QuickStart/application/
> > /var/www/html/QuickStart/application/controllers/
> > /var/www/html/QuickStart/application/views/
> > /var/www/html/QuickStart/application/views/scripts/
> > /var/www/html/QuickStart/library/
> > /var/www/html/QuickStart/public/
> >
> > The last directory 'public' wants to be the DocumentRoot
> > I want to set up a virtual server whose DocumentRoot is
> > /var/www/html/QuickStart/public
> >
> > my machine's name is confianza and it is running Fedora 10
> > [root at confianza conf]# uname -a
> > Linux confianza 2.6.27.21-170.2.56.fc10.i686 #1 SMP Mon Mar 23 23:37:54
> > EDT 2009 i686 i686 i386 GNU/Linux
> >
> > I set up /etc/hosts so both confianza and confianzazend resolve to
> > 127.0.0.1
> > [root at confianza conf]# grep 127.0.0.1 /etc/hosts
> > 127.0.0.1        localhost.localdomain localhost confianza confianzazend
> >
> >
> > My current apache web server uses /var/www/html as it's DocumentRoot and
> > runs fine.
> >
> >
> > [root at confianza conf]# yum list installed | grep -i http
> > httpd.i386                              2.2.11-2.fc10
> > installed
> > httpd-tools.i386                        2.2.11-2.fc10
> > installed
> > jakarta-commons-httpclient.i386         1:3.1-0.3.fc10
> > installed
> > system-config-httpd.noarch              5:1.4.4-2.fc10
> > installed
> > [root at confianza conf]# yum list installed | grep -i zend
> > php-ZendFramework.noarch
> >
> > I edited /etc/httpd/conf/httpd.conf as follows:
> > #
> > ServerName confianza:80
> > NameVirtualHost *:80
> > #
> > 
> > ServerName confianza
> > DocumentRoot "/var/www/html"
> > 
> > #
> > 
> > ServerName confianzazend
> > DocumentRoot "/var/www/html/QuickStart/public"
> > 
> >
> > I then restart httpd
> > [root at confianza html]# service httpd restart
> > Stopping httpd:                                            [  OK  ]
> > Starting httpd:                                            [  OK  ]
> >
> >
> > I want http://confianza to return the contents of /var/www/html
> > I want http://confianzazend to return the contents of
> > /var/www/html/QuickStart
> >
> >
> > What is happening is that both http://confianza and http://confianzazend
> > are both returning the contents of /var/www/html
> >
> > I've looked at several web pages and they all say the same thing, this
> > should just work (TM). It seems simple enough yet my problem persists.
> > What else do I need to do?
> >
> > Thanks
> 
> Dennis:
> 
> Having read the entire thread, so far, I don't believe that anyone else
> has actually identified the issue.
> 
> The issue is the use of:
> 
> 
> 
> You've got a wildcard in every "VirtualHost" declaration.  As a result,
> you're going to match on the very first VirtualHost, and never get past
> it.
> 
> Instead, your VirtualHost declaration needs to be specific about the
> hostname (or FQDN) for which it is supposed to serve up the particular web
> pages.
> 
> What you need to do, instead, is set:
> 
> 
> 
> and
> 
> 
> 
> -- 
> Mike Burger
> http://www.bubbanfriends.org
> 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
According to http://httpd.apache.org/docs/2.2/vhosts/name-based.html
using 

NameVirtualHost *:80

<VirtualHost *:80>
ServerName www.domain.tld
ServerAlias domain.tld *.domain.tld
DocumentRoot /www/domain
 </VirtualHost>

<VirtualHost *:80>
ServerName www.otherdomain.tld
DocumentRoot /www/otherdomain
 </VirtualHost>

should "Just Work" (tm)

after re-reading the page I thought to try an IP address so I changed httpd.conf to include

NameVirtualHost 127.0.0.1:80

<VirtualHost 127.0.0.1:80>
   ServerName confianza
   ServerAlias confianza
   DocumentRoot "/var/www/html"
</VirtualHost>
# this is for my zend server application
<VirtualHost 127.0.0.1:80>
   ServerName confianzazend
   ServerAlias confianzazend
   DocumentRoot "/var/www/html/Quickstart/public"
</VirtualHost>

This configuration WORKS. I still don't understand why the first one won't but for my purposes, 
I now have a working setup.

Thanks to everyone who offered help.
If (just for academic purposes) you want to keep this thread alive and get the *:80 approach working
I'll be glad to participate.

Dennis Kaptain



      ¡Obtén la mejor experiencia en la web! Descarga gratis el nuevo Internet Explorer 8. http://downloads.yahoo.com/ieak8/?l=mx




More information about the fedora-list mailing list