Sun WebServer 2.1 Installation Guide

Migrating the Sun WebServer 1.0 httpd.conf File

The Sun WebServer 1.0 /etc/http/httpd.conf file contains the basic directives for configuring the server as a whole, the individual virtual hosts, and the ports. The three primary block types are the server{} block, the url{} block, and the port{} block. Each of these types will be discussed in this section.

server{} Block

Converting the server{} block from Sun WebServer 1.0 to Sun WebServer 2.1 format is relatively straightforward. Most of the directives in 1.0 are the same in 2.1, with the following exceptions listed below:

acl_delegate_depth

The acl_delegate_depth directive, and the concept of delegation of access controls, is no longer supported in Sun WebServer. See "Migrating the Sun WebServer 1.0 access.acl File" in this document.

acl_enable

The acl_enable directive has been changed to access_enable.

To convert the acl_enable directive
  1. Search for the following Sun WebServer 1.0 directive in /etc/http/httpd.conf:


    acl_enable				yes
  2. Replace it in /etc/http/server1.httpd.conf with the following directive:


    access_enable 		yes

acl_file

The acl_file directive is no longer supported in the server{} block, because the server-level access control file is now configured to be: /etc/http/access.conf. This file name cannot be changed.

map

The map directive is no longer supported in the server{} block. All URL mappings must be made in a web site's map.conf file.

mime_add

The mime_add directive is no longer supported in Sun WebServer 2.1. All mime types must be specified in the mime.types file at either the server or site level.

To convert the mime_add directive
  1. Given the following Sun WebServer 1.0 directive:


    server {
    	mime_add			"image/.jpeg"			"JPG"
    }
  2. Make sure a mime.types file is specified in /etc/http/server1.httpd.conf:


    Note -

    If this file is shared among all the servers, changes will effect all httpd daemons



    server {
    	mime_file 			"/etc/http/mime.types
    }
  3. Add the new MIME mappings to the /etc/http/mime.types file:


    image/jpeg 			JPG

server{} Block Conversion
  1. Given the following Sun WebServer 1.0 server{} block in /etc/http/httpd.conf:


    server {
    	server_root							"/var/http/demo/"
    	server_user							"root"
    	mime_add										"image/jpeg"	"JPG"
    	mime_default_type	 text/html
    	acl_enable								"yes"
    	acl_file										"/etc/http/access.acl"
    	acl_delegate_depth			3
    
    	map			/cgi-bin/				/var/http/cgi-bin/			cgi	
    }
  2. Modify the server{} block in /etc/http/server1.httpd.conf:


    server {
    	server_root							"/var/http/demo/"
    	server_user							"http"
    	mime_file									"/etc/http/mime.types"
    	mime_default_type	 text/html
    	access_enable					"yes"
    }
  3. Add the MIME mapping to the /etc/http/mime.types file specified in (2):


    image/jpeg				JPG

url{} Block

In 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.1, 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.

To convert a Sun WebServer 1.0 url{} block to 2.1
  1. Add a new web site to the 2.1 server using the hthost command line utility.

  2. Modify the new configuration files created with the Sun WebServer 1.0 values, or with Sun WebServer 2.1 equivalents.

To create a 2.1 web site
  1. 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

Modifying the Server-Level Configuration File

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.1. 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).

Setting the connection end points of a web site
  1. 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
    }

Note -

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.


Modifying the Site-Level Configuration File

Most of the Sun WebServer 1.0 url{} block configuration directives can be copied directly into the Sun WebServer 2.1 site-level configuration file, /var/http/server1/websites/widgets/conf/widgets.site.conf, with following exceptions:

map

All Sun WebServer 2.1 URL mappings are now stored in a separate file: map.conf.

To convert the map directive
  1. Given the following Sun WebServer 1.0 directive in /etc/http/httpd.conf:


    url //widgets {
    	map 		/cgi-bin/			/var/http/shared/cgi-bin/			cgi
    }
  2. 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

To convert the mime_add directive
  1. Given the following Sun WebServer 1.0 directive in /etc/http/httpd.conf:


    url //widgets {
    	mime_add 				"image/jpeg"					"JPG"
    }
  2. Uncomment the mime_file directive in /var/http/server1/websites/widgets/conf/widgets.site.conf:


    url //widgets {
    	mime_file				"conf/mime.types"
    }
  3. Add the new mime mappings to the /var/http/server1/websites/widgets/conf/mime.types file:


    image/jpeg					JPG

port{} Block

There are two primary changes to the port{} blocks in Sun WebServer 2.1: the hosts_supported directive is no longer valid as the ports a host listens on are now listed using the conn_end_points directive in the url{} block, and all ports must have an ip_address specified. The IP address 0.0.0.0 is special and means "all valid IP addresses on this machine".

To convert a port{} block for a specific IP address
  1. Given the following Sun WebServer 1.0 port{} block:


    port 80 {
    	ip_address									129.128.127.126
    	keepalive_enable			"yes"
    	request_timeout				180
    	hosts_supported					widgets
    }
  2. Modify the widgets url{} block in /etc/http/server1.httpd.conf to have conn_end_points specified correctly:


    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
    }
  3. Add the port{} block to /etc/http/server1.httpd.conf (without the hosts_supported directive):


    port 80 {
    	ip_address									129.128.127.126
    	keepalive_enable			"yes"
    	request_timeout				180
    }
To convert a port{} block for all IP addresses
  1. Given the following Sun WebServer 1.0 port{} block example:


    port 1880 {
    	keepalive_enable				"yes"
    	request_timeout					180
    	hosts_supported					widgets
    }
  2. Modify the widgets url{} block in /etc/http/server1.httpd.conf to have conn_end_points specified correctly:


    url //widgets {
    	site_enable							"yes"
    	site_path 								"/var/http/server1/websites/widgets"
    	site_config							"conf/widgets.site.conf"
    	conn_end_points			:1880
    }
  3. Add the ip_address directive with the value 0.0.0.0 to the port{} block in /etc/http/server1.httpd.conf:


    port 1880 {
    	ip_address									0.0.0.0
    	keepalive_enable			"yes"
    	request_timeout				180
    }