# setting up vhosts

## simcop2387

ok i'm new to this so bear with me if i sound/act/am stupid

i'm trying to setup a set of virtual hosts (name based i think) so that when i goto

http://voots.bounceme.net:5121/ and http://deerfieldradio.bounceme.net:5121/ i get different pages but its hosted on the same ip and server.  this is what i've got setup in my /etc/apache/conf/vhosts/vhosts.conf (it is being included i've checked that already)

```

# $Header: /home/cvsroot/gentoo-x86/net-www/apache/files/conf/Vhosts.conf,v 1.2 2002/05/04 23:23:01 woodchip Exp $

################# Vhosts.conf

#This is where we store the VirtualHosts configuration. 

#

#Since Apache 1.3.19, we modified the setup to include some nice tricks:

#

#- We added the User and Group directives so VirtualHosts now work with

#  suexec directive. If set, Apache will run all cgi scripts under that

#  user and group (provided the uid and gid are > 1000 for security). The

#  directories and cgi files *must* belong to that user/group for the

#  feature to work

#- We added the Setenv VLOG directive. This works in conjunction with

#  the CustomLog in common.conf. When Setenv VLOG is set, apache will

#  create a /var/log/httpd/VLOG-YYYY-MM-<ServerName>.log instead of logging

#  to access_log. Use this instead of defining a special logfile for

#  each vhost, otherwise you eat up file descriptors.

#- You can also specify a path for the VLOG for each Vhost, for example,

#  to place the logs in each user's directory. However, if you want to

#  use the file for accounting, place it in a directory owned by root,

#  otherwise the user will be able to erase it.

#- I suggest only including the ErrorLog *only* if the vhost will use

#  cgi scripts. Again, it saves file descriptors!

#This is needed for Frontpage support

Port 5121

ServerRoot /etc/apache

ResourceConfig /dev/null

AccessConfig /dev/null

################# IP-based Virtual Hosts 

#<VirtualHost 192.168.2.100>

#User jmdault

#Group jmdault

#DocumentRoot /home/jmdault/public_html

#ServerName test2.com

#Setenv VLOG /home/jmdault/logs

#ErrorLogs /home/jmdault/test2-error_log

#RewriteEngine On

#RewriteOptions inherit

#</VirtualHost>

################# Named VirtualHosts

NameVirtualHost *

<VirtualHost *>

ServerName  voots.bounceme.net:5121

DocumentRoot /home/httpd/htdocs

</VirtualHost>

<VirtualHost *>

ServerName  deerfieldradio.bounceme.net:5121

DocumentRoot /home/httpd/radio

</VirtualHost>

```

and none of it works, they both go to the same place, in fact i can't even get apache to make it change where voots.bounceme.net goes with that in there.

i can't setup a DNS server, but thanks to www.no-ip.com i've got the dns entries for then all setup fine, i was wondering if anyone might be able to help.

i've got here my apache.conf and my commonapache.conf

apache.conf

```
# $Header: /home/cvsroot/gentoo-x86/net-www/apache/files/conf/apache.conf,v 1.2 2002/05/04 23:23:01 woodchip Exp $

### Main Configuration Section

### You really shouldn't change these settings unless you're a guru

###

ServerType standalone

ServerRoot /etc/apache

#ServerName localhost

#LockFile /etc/httpd/httpd.lock

PidFile /var/run/apache.pid

ScoreBoardFile /etc/apache/apache.scoreboard

ErrorLog logs/error_log

LogLevel warn

ResourceConfig /dev/null

AccessConfig /dev/null

DocumentRoot /home/httpd/htdocs

### Dynamic Shared Object (DSO) Support

### 

###

LoadModule mmap_static_module modules/mod_mmap_static.so

LoadModule env_module         modules/mod_env.so

LoadModule config_log_module  modules/mod_log_config.so

LoadModule agent_log_module   modules/mod_log_agent.so

LoadModule referer_log_module modules/mod_log_referer.so

LoadModule mime_magic_module  modules/mod_mime_magic.so

LoadModule mime_module        modules/mod_mime.so

LoadModule negotiation_module modules/mod_negotiation.so

LoadModule status_module      modules/mod_status.so

LoadModule info_module        modules/mod_info.so

LoadModule includes_module    modules/mod_include.so

LoadModule autoindex_module   modules/mod_autoindex.so

LoadModule dir_module         modules/mod_dir.so

LoadModule cgi_module         modules/mod_cgi.so

LoadModule asis_module        modules/mod_asis.so

LoadModule imap_module        modules/mod_imap.so

LoadModule action_module      modules/mod_actions.so

LoadModule speling_module     modules/mod_speling.so

LoadModule userdir_module     modules/mod_userdir.so

LoadModule proxy_module       modules/libproxy.so

LoadModule alias_module       modules/mod_alias.so

LoadModule rewrite_module     modules/mod_rewrite.so

LoadModule access_module      modules/mod_access.so

LoadModule auth_module        modules/mod_auth.so

LoadModule anon_auth_module   modules/mod_auth_anon.so

LoadModule dbm_auth_module    modules/mod_auth_dbm.so

LoadModule db_auth_module     modules/mod_auth_db.so

LoadModule digest_module      modules/mod_digest.so

LoadModule cern_meta_module   modules/mod_cern_meta.so

LoadModule expires_module     modules/mod_expires.so

LoadModule headers_module     modules/mod_headers.so

LoadModule usertrack_module   modules/mod_usertrack.so

LoadModule example_module     modules/mod_example.so

LoadModule unique_id_module   modules/mod_unique_id.so

LoadModule setenvif_module    modules/mod_setenvif.so

LoadModule vhost_alias_module   modules/mod_vhost_alias.so

<IfDefine SSL>

LoadModule ssl_module    extramodules/libssl.so

</IfDefine>

<IfDefine PHP4>

LoadModule php4_module    extramodules/libphp4.so

</IfDefine>

#  Reconstruction of the complete module list from all available modules

#  (static and shared ones) to achieve correct module execution order.

#  [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE UPDATE THIS, TOO]

ClearModuleList

AddModule mod_mmap_static.c

AddModule mod_env.c

AddModule mod_log_config.c

AddModule mod_log_agent.c

AddModule mod_log_referer.c

AddModule mod_mime_magic.c

AddModule mod_mime.c

AddModule mod_negotiation.c

AddModule mod_status.c

AddModule mod_info.c

AddModule mod_include.c

AddModule mod_autoindex.c

AddModule mod_dir.c

AddModule mod_cgi.c

AddModule mod_asis.c

AddModule mod_imap.c

AddModule mod_actions.c

AddModule mod_speling.c

AddModule mod_userdir.c

AddModule mod_proxy.c

AddModule mod_alias.c

AddModule mod_rewrite.c

AddModule mod_access.c

AddModule mod_auth.c

AddModule mod_auth_anon.c

AddModule mod_auth_dbm.c

AddModule mod_auth_db.c

AddModule mod_digest.c

AddModule mod_cern_meta.c

AddModule mod_expires.c

AddModule mod_headers.c

AddModule mod_usertrack.c

AddModule mod_example.c

AddModule mod_unique_id.c

AddModule mod_so.c

AddModule mod_setenvif.c

AddModule mod_vhost_alias.c

<IfDefine SSL>

AddModule mod_ssl.c

</IfDefine>

<IfDefine PHP4>

AddModule mod_php4.c

</IfDefine>

###

### Global Configuration

###

# Splitting up apache.conf into two files makes it possible to support

# multiple configurations on the same serer.  In commonapache.conf

# you keep directives that apply to all implementations and in this

# file you keep server-specific directives.  While we don't yet have

# multiple configurations out-of-the-box, this allows us to do that

# in the future easily.

Include conf/commonapache.conf

###

### IP Address/Port

###

#BindAddress *

Port 5121

Listen 5121

###

### Log configuration Section

###

# Single logfile with access, agent and referer information

# This is the default, if vlogs are not defined for the main server

CustomLog logs/access_log combined env=!VLOG

# If VLOG is defined in conf/vhosts/Vhosts.conf, we use this entry

#CustomLog "|/usr/sbin/apachesplitlogfile" vhost env=VLOG

###

### Virtual Hosts 

###

# We include different templates for Virtual Hosting. Have a look in the 

# vhosts directory and modify to suit your needs.

Include conf/vhosts/Vhosts.conf

#Include conf/vhosts/DynamicVhosts.conf

#Include conf/vhosts/VirtualHomePages.conf

###

### Performance settings Section

###

#

# Timeout: The number of seconds before receives and sends time out.

#

Timeout 300

#

# KeepAlive: Whether or not to allow persistent connections (more than

# one request per connection). Set to "Off" to deactivate.

#

KeepAlive On

#

# MaxKeepAliveRequests: The maximum number of requests to allow

# during a persistent connection. Set to 0 to allow an unlimited amount.

# We recommend you leave this number high, for maximum performance.

#

MaxKeepAliveRequests 100

#

# KeepAliveTimeout: Number of seconds to wait for the next request from the

# same client on the same connection.

#

KeepAliveTimeout 15

#

# Server-pool size regulation.  Rather than making you guess how many

# server processes you need, Apache dynamically adapts to the load it

# sees --- that is, it tries to maintain enough server processes to

# handle the current load, plus a few spare servers to handle transient

# load spikes (e.g., multiple simultaneous requests from a single

# Netscape browser).

#

# It does this by periodically checking how many servers are waiting

# for a request.  If there are fewer than MinSpareServers, it creates

# a new spare.  If there are more than MaxSpareServers, some of the

# spares die off.  The default values are probably OK for most sites.

#

MinSpareServers 4

MaxSpareServers 10

#

# Number of servers to start initially --- should be a reasonable ballpark

# figure.

#

StartServers 4

#

# Limit on total number of servers running, i.e., limit on the number

# of clients who can simultaneously connect --- if this limit is ever

# reached, clients will be LOCKED OUT, so it should NOT BE SET TOO LOW.

# It is intended mainly as a brake to keep a runaway server from taking

# the system with it as it spirals down...

#

MaxClients 150

#

# MaxRequestsPerChild: the number of requests each child process is

# allowed to process before the child dies.  The child will exit so

# as to avoid problems after prolonged use when Apache (and maybe the

# libraries it uses) leak memory or other resources.  On most systems, this

# isn't really needed, but a few (such as Solaris) do have notable leaks

# in the libraries. For these platforms, set to something like 10000

# or so; a setting of 0 means unlimited.

#

# NOTE: This value does not include keepalive requests after the initial

#       request per connection. For example, if a child process handles

#       an initial request and 10 subsequent "keptalive" requests, it

#       would only count as 1 request towards this limit.

#

MaxRequestsPerChild 500

Include  conf/addon-modules/mod_php.conf

Include  conf/addon-modules/mod_ssl.conf

Include  conf/vhosts/ssl.default-vhost.conf

Include  conf/addon-modules/apache.webalizer

```

commonapache.conf

```

User apache

Group apache

ServerAdmin root@localhost

<Directory />

  Options -All -Multiviews

  AllowOverride None

  Order deny,allow

  Deny from all

</Directory>

<IfModule mod_userdir.c>

    UserDir /home/httpd/users/*

    Options Indexes

</IfModule>

<IfModule mod_dir.c>

    DirectoryIndex index.html index.php index.php3 index.shtml index.cgi index.pl index.htm Default.htm default.htm

</IfModule>

AccessFileName .htaccess

<Files ~ "^\.ht">

    Order allow,deny

    Deny from all

</Files>

UseCanonicalName On

<IfModule mod_mime.c>

    TypesConfig conf/mime.types

</IfModule>

DefaultType text/plain

<IfModule mod_mime_magic.c>

    MIMEMagicFile conf/magic

</IfModule>

HostnameLookups Off

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

LogFormat "%h %l %u %t \"%r\" %>s %b" common

LogFormat "%{Referer}i -> %U" referer

LogFormat "%{User-agent}i" agent

LogFormat "%v %h %l %u %t \"%r\" %>s %b %T" script

LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" VLOG=%{VLOG}e" vhost

ServerSignature On

<IfModule mod_alias.c>

    Alias /icons/ /home/httpd/icons/

    ScriptAlias /cgi-bin/ /home/httpd/cgi-bin/

</IfModule>

<IfModule mod_autoindex.c>

    IndexOptions FancyIndexing

    AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

    AddIconByType (TXT,/icons/text.gif) text/*

    AddIconByType (IMG,/icons/image2.gif) image/*

    AddIconByType (SND,/icons/sound2.gif) audio/*

    AddIconByType (VID,/icons/movie.gif) video/*

    AddIcon /icons/binary.gif .bin .exe

    AddIcon /icons/binhex.gif .hqx

    AddIcon /icons/tar.gif .tar

    AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv

    AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip .bz2

    AddIcon /icons/a.gif .ps .ai .eps

    AddIcon /icons/layout.gif .html .shtml .htm .pdf

    AddIcon /icons/text.gif .txt

    AddIcon /icons/c.gif .c

    AddIcon /icons/p.gif .pl .py .php .php3

    AddIcon /icons/f.gif .for

    AddIcon /icons/dvi.gif .dvi

    AddIcon /icons/uuencoded.gif .uu

    AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl

    AddIcon /icons/tex.gif .tex

    AddIcon /icons/bomb.gif core

    AddIcon /icons/back.gif ..

    AddIcon /icons/hand.right.gif README

    AddIcon /icons/folder.gif ^^DIRECTORY^^

    AddIcon /icons/blank.gif ^^BLANKICON^^

    DefaultIcon /icons/unknown.gif

    AddDescription "GZIP compressed document" .gz

    AddDescription "tar archive" .tar

    AddDescription "GZIP compressed tar archive" .tgz

    ReadmeName README

    HeaderName HEADER

    IndexIgnore .??* *~ *# HEADER* RCS CVS *,v *,t

</IfModule>

<IfModule mod_mime.c>

    AddEncoding x-compress Z

    AddEncoding x-gzip gz tgz

    AddLanguage da .dk

    AddLanguage nl .nl

    AddLanguage en .en

    AddLanguage et .ee

    AddLanguage fr .fr

    AddLanguage de .de

    AddLanguage el .el

    AddLanguage he .he

    AddCharset ISO-8859-8 .iso8859-8

    AddLanguage it .it

    AddLanguage ja .ja

    AddCharset ISO-2022-JP .jis

    AddLanguage kr .kr

    AddCharset ISO-2022-KR .iso-kr

    AddLanguage no .no

    AddLanguage pl .po

    AddCharset ISO-8859-2 .iso-pl

    AddLanguage pt .pt

    AddLanguage pt-br .pt-br

    AddLanguage ltz .lu

    AddLanguage ca .ca

    AddLanguage es .es

    AddLanguage sv .se

    AddLanguage cz .cz

    AddLanguage ru .ru

    AddLanguage zh-tw .tw

    AddLanguage tw .tw

    AddCharset Big5         .Big5    .big5

    AddCharset WINDOWS-1251 .cp-1251

    AddCharset CP866        .cp866

    AddCharset ISO-8859-5   .iso-ru

    AddCharset KOI8-R       .koi8-r

    AddCharset UCS-2        .ucs2

    AddCharset UCS-4        .ucs4

    AddCharset UTF-8        .utf8

    <IfModule mod_negotiation.c>

        LanguagePriority en fr de es it da nl et el ja kr no pl pt pt-br ru ltz ca sv tw

    </IfModule>

    AddType application/x-tar .tgz

    AddHandler cgi-script .cgi

    AddType text/html .shtml

    AddHandler server-parsed .shtml

    AddHandler imap-file map

</IfModule>

# MetaDir: specifies the name of the directory in which Apache can find

# meta information files. These files contain additional HTTP headers

# to include when sending the document

MetaDir .web

# MetaSuffix: specifies the file name suffix for the file containing the

# meta information.

MetaSuffix .meta

<IfModule mod_setenvif.c>

    BrowserMatch "Mozilla/2" nokeepalive

    BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0

    BrowserMatch "RealPlayer 4\.0" force-response-1.0

    BrowserMatch "Java/1\.0" force-response-1.0

    BrowserMatch "JDK/1\.0" force-response-1.0

</IfModule>

<IfModule mod_status.c>

    <Location /server-status>

        SetHandler server-status

        Order deny,allow

        Deny from all

        allow from 127.0.0.1 192.168.10.

        #Allow from .your_domain.com

    </Location>

ExtendedStatus On

</IfModule>

<IfModule mod_info.c>

    <Location /server-info>

   SetHandler server-info

   Order deny,allow

   Deny from all

   Allow from 127.0.0.1 192.168.10.

   #Allow from .your_domain.com

    </Location>

</IfModule>

<IfModule mod_perl.c>

    <Location /perl-status>

   SetHandler perl-script

   PerlHandler Apache::Status

   Order deny,allow

   Deny from all

   Allow from 127.0.0.1 192.168.10.

   #Allow from .your_domain.com

    </Location>

</IfModule>

<Location /cgi-bin/phf*>

    Deny from all

    ErrorDocument 403 http://phf.apache.org/phf_abuse_log.cgi

</Location>

#

# Proxy Server directives. Uncomment the following lines to

# enable the proxy server:

#

#<IfModule mod_proxy.c>

#    ProxyRequests On

#    <Directory proxy:*>

#        Order deny,allow

#        Deny from all

#        Allow from .your_domain.com

#    </Directory>

    #

    # Enable/disable the handling of HTTP/1.1 "Via:" headers.

    # ("Full" adds the server version; "Block" removes all outgoing Via: headers)

    # Set to one of: Off | On | Full | Block

    #

#    ProxyVia On

    #

    # To enable the cache as well, edit and uncomment the following lines:

    # (no cacheing without CacheRoot)

    #

#    CacheRoot /var/cache/apache

#    CacheSize 5

#    CacheGcInterval 4

#    CacheMaxExpire 24

#    CacheLastModifiedFactor 0.1

#    CacheDefaultExpire 1

#    NoCache a_domain.com another_domain.edu joes.garage_sale.com

#</IfModule>

# End of proxy directives.

<IfModule mod_dav.c>

     DavLockDB /var/lock/mod_dav

</IfModule>

<IfModule mod_include.c>

</IfModule>

<Directory /home/httpd/htdocs>

    Options Indexes FollowSymLinks MultiViews

    AllowOverride All

    Order allow,deny

    Allow from all

</Directory>

<Directory /home/httpd/cgi-bin>

    AllowOverride All

    Options ExecCGI

    Order allow,deny

    Allow from all

</Directory>

<Directory /home/httpd/users/*/>

    AllowOverride All

    Options MultiViews Indexes Includes FollowSymLinks

    Order allow,deny

    Allow from all

</Directory>

<Directory /home/httpd/users/*/cgi-bin>

     Options +ExecCGI -Includes -Indexes

     SetHandler cgi-script

</Directory>

<IfModule mod_perl.c>

    <Directory /home/httpd/users/*/perl>

   SetHandler perl-script

   PerlHandler Apache::PerlRun

   Options -Indexes ExecCGI

   PerlSendHeader On

    </Directory>

</IfModule>

<Directory /home/httpd/icons>

    Options -Indexes MultiViews

    AllowOverride None

    Order allow,deny

    Allow from all

</Directory>

<Directory /usr/share/doc>

    Options Indexes FollowSymLinks

    Order deny,allow

    Deny from all

    Allow from 127.0.0.1

</Directory>

<Location /index.shtml>

    Options +Includes

</Location>

```

----------

## Rroet

Mmm, not to be blund... but there's a nice SEARCH button on the top of you screen. And there's even a new forums section entirely devoted to duplicate postings.

try looking for "apache vhosts" under the search button. You should find about a few hunderd postings.

----------

