|

|
 | Virtual Server Documentation |
Home | Getting Started | FreeBSD | Solaris | Handbook
Manually Configuring Virtual Subhosts
In order to manually configure a Virtual Subhost,
connect to your Virtual Server via
Telnet or SSH
and do the following.
-
For each Virtual Subhost you configure on your Virtual Server you will need
to create a new directory for the Virtual Subhost domain files. It is best
(to ensure compatibility with the latest version of
Microsoft FrontPage)
to create the new directory in your Virtual Server
~/www/vhosts directory.
% mkdir -p ~/usr/local/etc/httpd/vhosts/subhost-domain
-
Open up your Virtual Server ~/www/conf/httpd.conf file
and add the following lines in the <VirtualHost>
section (again, to ensure compatibility with Microsoft FrontPage) of the file.
If your Virtual Server was set up with just one web server configuration
file (httpd.conf), then the <VirtualHost> section is found in the
middle of the file. If your Virtual Server was set up with
three separate configuration files (httpd.conf, srm.conf, and access.conf), then
the <VirtualHost> section is found at the bottom of the file.
# point www.SUBHOST-DOMAIN.NAME and SUBHOST-DOMAIN.NAME
# to subdirectory subhost-domain
<VirtualHost www.SUBHOST-DOMAIN.NAME SUBHOST-DOMAIN.NAME>
ServerName www.SUBHOST-DOMAIN.NAME
ServerAdmin webmaster@SUBHOST-DOMAIN.NAME
DocumentRoot /usr/local/etc/httpd/vhosts/subhost-domain
</VirtualHost>
You must substitute the Virtual Subhost domain name in place of
SUBHOST-DOMAIN.NAME and the name of the directory you created
for the Virtual Subhost for subhost-domain above.
Also, be sure that the first domain name you list in the <VirtualHost...>
directive above matches the domain name you specify as the ServerName
(once again, to ensure compatibility with Microsoft FrontPage).
NOTE:
If your Virtual Server was set up prior to July 1, 1999,
it is likely that a <Directory> directive like the following will need to be
created at the bottom of your Virtual Server ~/www/conf/httpd.conf file
(or at the bottom of your ~/www/conf/access.conf file if you have
three separate web server configuration files).
<Directory /usr/local/etc/httpd/vhosts>
Options Indexes FollowSymLinks Includes
AllowOverride All
order allow,deny
allow from all
</Directory>
|
|
NOTE:
If your Virtual Server is running
Apache Web Server 1.3 then
it is necessary to add the following line to your web server configuration
file (~/www/conf/httpd.conf).
NameVirtualHost YOUR.IP.ADD.RESS:*
|
-
Many of your Virtual Subhost customers will want to install their own CGIs into their own
cgi-bin directory. If you choose to provide this feature, first you must create a
cgi-bin directory for the Virtual Subhost.
mkdir ~/usr/local/etc/httpd/vhosts/subhost-domain/cgi-bin
Then, use the
ScriptAlias directive in the
~/www/conf/httpd.conf file on your Virtual Server
(or possibly the ~/www/conf/srm.conf file)
# point www.SUBHOST-DOMAIN.NAME and SUBHOST-DOMAIN.NAME
# to subdirectory subhost-domain
<VirtualHost www.SUBHOST-DOMAIN.NAME SUBHOST-DOMAIN.NAME>
ServerName www.SUBHOST-DOMAIN.NAME
ServerAdmin webmaster@SUBHOST-DOMAIN.NAME
DocumentRoot /usr/local/etc/httpd/vhosts/subhost-domain
ScriptAlias /cgi-bin/ /usr/local/etc/httpd/vhosts/subhost-domain/cgi-bin/
</VirtualHost>
|
NOTE:
It is important to understand the
Virtual Subhosting Security Issues
involved when giving cgi-bin access to your
Virtual Subhost customers. Giving your Virtual Subhost customers
cgi-bin access is a potential security risk!
The CGIs your customers upload and execute have all of the
rights and privileges of the CGIs you execute. Therefore, it is
possible for a Virtual Subhost customer, which has been granted
CGI privileges, to read or remove any file in your directory hierarchy.
Moreover, it is possible for a malicious Virtual Subhost customer to crack
weak passwords and gain shell access to your Virtual Server.
|
-
Many of your Virtual Subhost customers will want their own separate web server log
files. If you choose to provide this feature, first you must create a
logs directory for the Virtual Subhost web server log files.
% mkdir ~/usr/local/etc/httpd/vhosts/subhost-domain/logs
Then, use the TransferLog and ErrorLog directives
to configure the web server log files in your ~/www/conf/httpd.conf.
# point www.SUBHOST-DOMAIN.NAME and SUBHOST-DOMAIN.NAME
# to subdirectory subhost-domain
<VirtualHost www.SUBHOST-DOMAIN.NAME SUBHOST-DOMAIN.NAME>
ServerName www.SUBHOST-DOMAIN.NAME
ServerAdmin webmaster@SUBHOST-DOMAIN.NAME
DocumentRoot /usr/local/etc/httpd/vhosts/subhost-domain
TransferLog /usr/local/etc/httpd/vhosts/subhost-domain/logs/access_log
ErrorLog /usr/local/etc/httpd/vhosts/subhost-domain/logs/error_log
</VirtualHost>
-
Most Apache Web Server
resource directives can be included in your
<VirtualHost> definition. For example, we can
include the ErrorDocument directive in order to define a
"Not Found Document" for the Virtual Subhost.
# point www.SUBHOST-DOMAIN.NAME and SUBHOST-DOMAIN.NAME
# to subdirectory subhost-domain
<VirtualHost www.SUBHOST-DOMAIN.NAME SUBHOST-DOMAIN.NAME>
ServerName www.SUBHOST-DOMAIN.NAME
ServerAdmin webmaster@SUBHOST-DOMAIN.NAME
DocumentRoot /usr/local/etc/httpd/vhosts/subhost-domain
ErrorDocument 404 /notfound.html
</VirtualHost>
The "Not Found Document" location is specified with respect to the
DocumentRoot. So, in the example above, the actual file location of
notfound.html is:
~/usr/local/etc/httpd/vhosts/subhost-domain/notfound.html
-
Finally, your Virtual Subhost customer will probably want a file upload
account, in order to upload their own web site to the Virtual Subhost directory.
Use the vadduser command to create
Virtual Server FTP User Accounts for your Virtual Subhost
customers.
When prompted for the account "home" directory,
you will probably want to specify the same value that you used
for the DocumentRoot directive above. This will allow your
Virtual Subhost customer to upload web content to the directory which the
web server recognizes as the home directory for the Virtual Subhost domain
name.
For more details about Virtual Subhosts and e-mail, see the following.
- Virtmaps - Providing E-Mail for Virtual Subhosts
|