url{}
BlockIn Sun WebServer 1.0, all the configuration parameters for a virtual host were found in a single location in the /etc/http/httpd.conf file. In Sun WebServer 2.0, global information for the virtual host is located in the server-level configuration file, and more specific information is located in the site-level configuration file.
url{}
block to 2.0Add a new web site to the 2.0 server using the hthost command line utility.
Modify the new configuration files created with the Sun WebServer 1.0 values, or with Sun WebServer 2.0 equivalents.
Add a web site (widgets), to the current server (server1):
# hthost add -i server1 -h widgets \ -s /var/http/server1/websites/widgets |
This will add the following entry to the server-level configuration file, /etc/http/server1.httpd.conf:
url //widgets { site_enable "yes" site_path "/var/http/server1/websites/widgets" site_config "conf/widgets.site.conf" } |
It will also create a new web site at: /var/http/server1/websites/widgets/. The following configuration files will be placed in the directory /var/http/server1/websites/widgets/conf/:
widgets.site.conf
access.conf
realms.conf
map.conf
content.conf
servlets.properties
Most of the configuration parameters from the Sun WebServer 1.0 url{}
blocks will be placed in the site-level configuration file, widgets.site.conf. One exception is setting the ports on which a virtual host listens. For each virtual host, one must specify on which IP addresses and ports it accepts connections. (This is different than in 1.0, where this information was stored in the port{}
blocks using the hosts_supported
directive.) IP address:port pairs are termed "connection end points" in Sun WebServer 2.0. All web sites should have their connection end points specified (with the exception of the default web site, which listens on all interfaces and does not allow connection end points to
be defined). For more information on connection end points, see httpd.conf (4).
To have the virtual host, widgets, accept connections on IP address 129.128.127.126 on port 80, and all IP addresses on port 1880, write the following in /etc/http/server1.httpd.conf:
url //widgets { site_enable "yes" site_path "/var/http/server1/websites/widgets" site_config "conf/widgets.site.conf" conn_end_points 129.128.127.126:80:1880 } |
Not specifying IP address to the left of the colon (:) defaults to "all IP addresses" in a HTTP 1.1 virtual host. Also note that all connection end points specified must be mapped by port{}
blocks.
Most of the Sun WebServer 1.0 url{}
block configuration directives can be copied directly into the Sun WebServer 2.0 site-level configuration file, /var/http/server1/websites/widgets/conf/widgets.site.conf, with following exceptions:
All Sun WebServer 2.0 URL mappings are now stored in a separate file: map.conf.
Given the following Sun WebServer 1.0 directive in /etc/http/httpd.conf:
url //widgets { map /cgi-bin/ /var/http/shared/cgi-bin/ cgi } |
Add the following line to the /var/http/server1/websites/widgets/conf/map.conf file at the widgets site:
map /cgi-bin/ /var/http/shared/cgi-bin/ cgi |
mime_add
mime_add
directive Given the following Sun WebServer 1.0 directive in /etc/http/httpd.conf:
url //widgets { mime_add "image/jpeg" "JPG" } |
Uncomment the mime_file
directive in /var/http/server1/websites/widgets/conf/widgets.site.conf:
url //widgets { mime_file "conf/mime.types" } |
Add the new mime mappings to the /var/http/server1/websites/widgets/conf/mime.types file:
image/jpeg JPG |