LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-22-2011, 07:01 AM   #1
qlands
Member
 
Registered: Sep 2010
Posts: 67

Rep: Reputation: 0
Angry Help with apache with virtual hosts


Hi,

What do I need to do to use virtual hosts in apache?

I have this configuration in httpd-vhosts.conf

Code:
#NameVirtualHost *:80

<VirtualHost *>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "/srv/httpd/htdocs"
    ServerName rmg.ilri.cgiar.org
    ErrorLog "/var/log/httpd/error_log"
    CustomLog "/var/log/httpd/access_log" common
</VirtualHost>

<VirtualHost *>
    <Directory /var/www/git.darkstar.ilri.org/gitorious/public>
        Options FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from All
    </Directory>

    DocumentRoot /var/www/git.darkstar.ilri.org/gitorious/public
    ServerName repository.rmg.ilri.cgiar.org

    ErrorLog /var/log/httpd/repository_log
    CustomLog /var/log/httpd/repository_log combined

    # Gzip/Deflate
    # http://fluxura.com/2006/5/19/apache-for-static-and-mongrel-for-rails-with-mod_deflate-and-capistrano-support
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css application/x-javascript
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

    # Far future expires date
    <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
        ExpiresActive On
        ExpiresDefault "access plus 1 year"
    </FilesMatch>

    # No Etags
    FileETag None

    RewriteEngine On

    # Check for maintenance file and redirect all requests
    RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
    RewriteCond %{SCRIPT_FILENAME} !maintenance.html
    RewriteRule ^.*$ /system/maintenance.html [L]
</VirtualHost>
But when I type rmg.ilri.cgiar.org or repository.rmg.ilri.cgiar.org both go to the DocumentRoot of the first (/srv/httpd/htdocs)!

Do I need to remove some lines from httpd.conf if I use virtual hosts?

Both rmg.ilri.cgiar.org and repository.rmg.ilri.cgiar.org are declared elsewhere in a Windows Domain server.

Any help is much appreciated.
Carlos
 
Old 09-22-2011, 07:26 AM   #2
qlands
Member
 
Registered: Sep 2010
Posts: 67

Original Poster
Rep: Reputation: 0
Smile

I fixed!

Just un-commented NameVirtualHost *:80 and added *:80 to each virtual host and works perfectly!
 
Old 09-22-2011, 07:29 AM   #3
ponce
LQ Guru
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 7,090

Rep: Reputation: 4173Reputation: 4173Reputation: 4173Reputation: 4173Reputation: 4173Reputation: 4173Reputation: 4173Reputation: 4173Reputation: 4173Reputation: 4173Reputation: 4173
you have to uncomment the NameVirtualHost directive to use name-based virtual hosting.

oops, too late

Last edited by ponce; 09-22-2011 at 07:30 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 2 and virtual hosts Ephracis Linux - Software 2 06-16-2008 05:37 AM
Apache with virtual hosts linuxmandrake Linux - Security 1 09-14-2006 12:53 PM
APACHE - Virtual Hosts luca2 Linux - Networking 3 12-27-2005 07:32 PM
Apache Virtual Hosts quozt Linux - General 3 10-15-2003 09:51 AM
Apache virtual hosts Mil0 Linux - Software 5 06-01-2003 11:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 01:39 AM.

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