LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-28-2006, 06:05 AM   #1
ddaas
Member
 
Registered: Oct 2004
Location: Romania
Distribution: Ubuntu server, FreeBsd
Posts: 474

Rep: Reputation: 30
apache 2.0.54 Virtual host problem (FC4)


Hi,
I'm trying to configure Apache-2.0.54 for Virtual Hosting.

I want something like this:

www.example.com/admin/secure
/home/example/htdocs/admin/secure

www.example.com/stats
/var/www/stats

The first virtual host in the config file seems to be run by apache.
If I write in the browser: www.example.com I am redirected to /home/example/htdocs/admin/secur
If I write in the browser: www.example.com/secure I get file not found.


So, I want Virtual hosts for the same domain (www.example.com), only the URI is diferent (admin/secure and stats). It seems I do something wrong.

Could someone give me a hint please !

My config:
Quote:
NameVirtualHost *:80
368
369 <VirtualHost *:80>
370 ServerName www.example.com/stats
371 DocumentRoot "/var/www/stats"
372 <Directory "/var/www/stats">
373 AuthType Basic
374 AuthName "Title2"
375 AuthUserFile /etc/httpd/conf/.htpasswd
376 Require valid-user
377 </Directory>
378 </VirtualHost>
379
380
381 <VirtualHost *:80>
382 ServerName www.example.com/admin/secure
383 DocumentRoot "/home/example/htdocs/admin/secure"
384 <Directory "/home/example/htdocs/admin/secure">
385 AuthType Basic
386 AuthName "Title1"
387 AuthUserFile /etc/httpd/conf/.htpasswd
388 Require valid-user
389 </Directory>
390 </VirtualHost>
 
Old 01-28-2006, 07:28 AM   #2
dimsh
Member
 
Registered: Aug 2005
Distribution: Debian, Ubuntu, Fedora
Posts: 74

Rep: Reputation: 15
use the Alias directive instead of dsefining two virtual hosts of the same name, that will not work.

Quote:
NameVirtualHost *:80
368
369 <VirtualHost *:80>
370 ServerName www.example.com
371 DocumentRoot "/var/www/stats"
Alias /stats /var/www/stats
372 <Directory "/var/www/stats">
373 AuthType Basic
374 AuthName "Title2"
375 AuthUserFile /etc/httpd/conf/.htpasswd
376 Require valid-user
377 </Directory>


Alias /admin/secure /home/example/htdocs/admin/secure
384 <Directory "/home/example/htdocs/admin/secure">
385 AuthType Basic
386 AuthName "Title1"
387 AuthUserFile /etc/httpd/conf/.htpasswd
388 Require valid-user
389 </Directory>
390 </VirtualHost>
This should work
 
Old 01-28-2006, 04:56 PM   #3
ddaas
Member
 
Registered: Oct 2004
Location: Romania
Distribution: Ubuntu server, FreeBsd
Posts: 474

Original Poster
Rep: Reputation: 30
thanks,
that helped !
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache Virtual Host Problem eckertc1 Linux - Newbie 11 03-23-2005 03:31 PM
Apache Virtual Host problem Seventh Linux - Software 2 03-19-2005 06:33 PM
Apache and Virtual Host Problem sekondborn Linux - Software 9 02-12-2005 02:26 PM
Apache virtual host problem Adrohak Linux - Software 3 07-18-2004 04:17 PM
Virtual Host Problem using Apache ataber Linux - Newbie 2 01-27-2003 12:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration