Re: Apache configuration problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2008-05-19 at 12:55 +0100, Paul wrote:
> If I try in Firefox http://127.0.0.1 - it will come up with the first
> of the VirtualHosts. However, if I have 127.0.0.1/test123, Apache
> complains that the URL test123 is not on this.

That request's not making use of virtual hosts, you're asking for a
test123 sub-directory off the default site.  Virtual hosts are when you
have different hostnamed websites on the same IP address.  As far as
browsing them's concerned, they're completely independent websites.

example /etc/hosts file:

  127.0.0.1  localhost.localdomain  localhost  example.com  example.net

example browsing requests:

  http://localhost/
  http://example.com/
  http://example.net/

example Apache configuration sections:

  <VirtualHost *:80>
        ServerName       localhost
        ServerAlias      localhost.localdomain
  # This alias makes this section respond to both hostnames
        UseCanonicalName On
        DocumentRoot     /var/www/virtuals/localhost
  </VirtualHost>

  <VirtualHost *:80>
        ServerName       example.com
        UseCanonicalName On
        DocumentRoot     /var/www/virtuals/example.com
  </VirtualHost>

  <VirtualHost *:80>
        ServerName       example.net
        UseCanonicalName On
        DocumentRoot     /var/www/virtuals/example.net
  </VirtualHost>

NB:  I don't make virtual hosts as sub-directories inside the
default /var/www/html directory, I give them a completely separate path
(as above).  That way you cannot access a different website through one
of the others.  Doing so can allow some devious sidestepping of any
access limitations that you'd applied to a virtual host.

-- 
[tim@bigblack ~]$ uname -ipr
2.6.23.15-80.fc7 i686 i386

Don't send private replies to my address, the mailbox is ignored.
I read messages from the public lists.




-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux