TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [TCLUG:20911] Virtual Host and Forbidden
On Thu, Aug 31, 2000 at 03:44:42PM -0700, isla0005@tc.umn.edu wrote:
>
> I have added the following lines on my httpd.conf
>
> NameVirtualHost 24.111.111.111.11
...[snip]...
> ** IP address is just a dummy one
I hope so! I don't see how this would even work! ;-) Anyway, if Adam's
question to you wasn't something to spark the lightbulb for ya, why don't you
take a look at my apache site config file. I do use the NameVirtualHost as do
you. However, for each site, I create a separate .conf file and include it at
the end of my httpd.conf file.
# Set up the hosts
Listen 192.168.1.10
NameVirtualHost 192.168.1.10
Listen 192.168.1.11
NameVirtualHost 192.168.1.11
# Include the Site specific conf files
include site/wookimus.net
include site/_default_
include site/localhost
Then in my site conf files, I have (GODDAMNIT! Debian's Apache install deleted
my "sites" directory again! Will I never learn!):
####### BEGIN FILE #######
# SITE CONFIGURATION FILE
# Domain: wookimus.net
# Contact: chewie@wookimus.net
# Host: skuld
# IP: 192.168.1.10
# Updated: 2000/08/31
<Directory /var/www/wookimus.net/htdocs>
AllowOverride AuthConfig FileInfo
Options Indexes Includes
order allow,deny
allow from all
deny from .ihatethesepeople.com .andthesepeople.com
</Directory>
<Directory /var/www/wookimus.net/cgi-bin>
AllowOverride AuthConfig FileInfo
Options ExecCGI
</Directory>
<Directory /var/www/wookimus.net/log>
AllowOverride AuthConfig FileInfo
Options Indexes Includes
order deny,allow
deny from all
allow from localhost .wookimus.net
</Directory>
<VirtualHost 192.168.1.10>
ServerAdmin webmaster@wookimus.net
DocumentRoot /var/www/wookimus.net/htdocs
ScriptAlias /cgi-bin/ "/var/www/wookimus.net/cgi-bin/"
ServerName wookimus.net
ServerAlias *.wookimus.net
ErrorLog /var/www/wookimus.net/log/error.log
TransferLog /var/www/wookimus.net/log/access.log
</VirtualHost>
####### END FILE #######
I then make the permissions of the directories look like this:
total 5
drwxr-xr-x 5 root root 1024 Aug 25 22:59 .
drwxr-xr-x 3 root root 1024 Aug 25 22:38 ..
drwxrwxr-x 2 chewie wookweb 1024 Aug 25 22:38 cgi-bin
drwxrwxr-x 2 chewie wookweb 1024 Aug 25 23:30 htdocs
drwxrwxr-x 2 www-data www-data 1024 Aug 25 22:59 log
where .. is the /var/www/wookimus.net directory. Note that it is owned
by root and is read/execute only. This enforces the directory
structure directly under wookimus.net. The log directory must be
writeable by Apache so it can take logs, thus the www-data
ownership.group. Otherwise, cgi-bin and htdocs are rwx for the
owner.group of the maintainer of the site.
This seems to work out fine for me. In fact, it's such a canned
setup, that creating a script to automate the creation of new sites is
pretty menial. I won't take full credit for this setup; it is
inspired by a friend of mine who just so happens to manage
SourceForge.Net in this manner. ;-)
If you really want to get funky...
# ...[snip]...
<Directory "/home/groups">
AllowOverride AuthConfig FileInfo
Options Indexes Includes
Order allow,deny
Allow from all
</Directory>
# ...[snip]...
######################################################################
### Begin http://project.sourceforge.net Named Based Virtual Hosts ###
######################################################################
<VirtualHost 192.168.4.52>
ServerName %1.sourceforge.net
VirtualDocumentRoot /home/groups/%1/htdocs
VirtualScriptAlias /home/groups/%1/cgi-bin
</VirtualHost>
### End http://project.sourceforge.net Named Based Virtual Hosts ###
## Custom Requests
# ...[snip]...
Gee...wonder where I snatched that configuration from... ;-)
--
Chad "^chewie, gunnarr" Walstrom <chewie@wookimus.net>
http://wookimus.net/chewie
PGP signature