[Gloucs] More on Apache vhosts

Richard Mellersh richard at the-sett.nildram.co.uk
Wed Sep 22 21:49:53 BST 2004


Guy Edwards - Thank you see right at the bottom of this mail - I thought 
"signature" was just that: a scan of ones Signature.  Oh well!

As you have now gathered my ambitions outweigh my skills, but hey, I'm trying 
right?  By the way, did I mention that I hate all that Bill Gates stands for 
and that's why I'm into Linux?).

Right back to the problem.

here is a what happens when I try to start apache - I seem to have done the 
things that you are suggesting):-
===================================================
[root at brock root]# service httpd2 start
Starting httpd2: [Wed Sep 22 21:27:20 2004] [error] (EAI 2)Name or service not 
known: Cannot resolve host name bct.the-sett.org --- ignoring!
[Wed Sep 22 21:27:20 2004] [error] (EAI 2)Name or service not known: Cannot 
resolve host name amelia.the-sett.org --- ignoring!
[Wed Sep 22 21:27:20 2004] [warn] NameVirtualHost 192.168.0.50:0 has no 
VirtualHosts
[Wed Sep 22 21:27:20 2004] [warn] NameVirtualHost 192.168.0.50:0 has no 
VirtualHosts
(98)Address already in use: make_sock: could not bind to address 
195.112.17.79:80
no listening sockets available, shutting down
Unable to open logs

                                                                [FAILED]
[root at brock root]#
====================================================
Now, there are several problems here, probably if I copy the config files it 
will be easiyer than trying to explain as I have made so many changes I loose 
track.  To pick out the salient bits I'll put a whole bunch of carats below 
each line, that may save you ploughing through standard stuff and equals 
before and after each extract.

httpd2.conf at the start
====================================================
[root at brock conf]# cat httpd2.conf
### Main Configuration Section
### You really shouldn't change these settings unless you're a guru
###
ServerRoot /etc/httpd/2.0
#ServerName localhost
#LockFile /etc/httpd/httpd.lock
PidFile /var/run/httpd.pid
ErrorLog logs/error_log
LogLevel warn
## DocumentRoot /var/www/html
DocumentRoot /var/www/bct
^^^^^^^^^^^^^^^^^
========================================================
then all the module stuff 
and at the end:-
========================================================
###
### 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
# prefork MPM [THIS IS THE DEFAULT]
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
StartServers         5
MinSpareServers      5
MaxSpareServers     10
MaxClients         150
MaxRequestsPerChild  0
</IfModule>
NameVirtualHost 192.168.0.50
## <Directory "/public/www/amelia">
^^^^^^^^^^^^^^^^^^^^^^^^
## </Directory>
# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule worker.c>
StartServers         2
MaxClients         150
MinSpareThreads     25
MaxSpareThreads     75
ThreadsPerChild     25
MaxRequestsPerChild  0
</IfModule>
# perchild MPM
# NumServers: constant number of server processes
# StartThreads: initial number of worker threads in each server process
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# MaxThreadsPerChild: maximum number of worker threads in each server process
# MaxRequestsPerChild: maximum number of connections per server process
<IfModule perchild.c>
NumServers           5
StartThreads         5
MinSpareThreads      5
MaxSpareThreads     10
MaxThreadsPerChild  20
MaxRequestsPerChild  0
</IfModule>
========================================================
and this is vhosts.conf
=====================================================
[root at brock vhosts]# cat Vhosts.conf
################# 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 > 100 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!
#- We added the Rewrite directives so vhosts will work with the
#  PERLPROXIED configuration


################# 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 111.222.33.44
#<VirtualHost 111.222.33.44>
#ServerName www.domain.tld
#ServerPath /domain
#DocumentRoot /web/domain
#</VirtualHost>

################ My turn to try options ####################
### this bit seems to setup the name that people use to ###
### select which v/host to get ###
NameVirtualHost 192.168.0.50
### the first one should be for the default site ###
### bct I don't know why but I read it in the docs ###

<VirtualHost bct.the-sett.org>
ServerName bct.the-sett.org
^^^^^^^^^^^^^^^^^^^^^^^^^
DocumentRoot "/var/www/bct"
#Setenv VLOG /home/jmdault/logs
#ErrorLogs /home/jmdault/test2-error_log
#RewriteEngine On
#RewriteOptions inherit
</VirtualHost>

<VirtualHost amelia.the-sett.org>
### lets try the Goddaughters bit ###
ServerName amelia.the-sett.org
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
DocumentRoot "/public/www/amelia"
#Setenv VLOG /home/jmdault/logs
#ErrorLogs /home/jmdault/test2-error_log
#RewriteEngine On
#RewriteOptions inherit
</VirtualHost>

### and this bit tells httpd2 where to find it ###
<Directory "/public/www/amelia">
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^6
        Options MultiViews FollowSymLinks
        AllowOverride none
        ErrorDocument 404 /my404.php
        DirectoryIndex index.htm index.html default.htm default.html
        Order allow,deny
        Allow from all
</Directory>
====================================================
Sorry if this is hard going.

The next problem is the ip number:-
Before I had my new fast machine (or the old one that ipcop is now on) I just 
used the SCSI beast for everything, including MANUAL dialup. It still has the 
Fritz card in it and, of course, it (apache) thinks that it should bind 
something to the old ip number of the ISDN Fritz card instead of WHAT I don't 
know?????

Thanks for your patience
Richard

-- 
This reply is via KMail from Richard Mellersh
This is just a test of this feature.




More information about the gloucs mailing list