I apologise for my incomplete bug report. Here it is again.
System: Solaris 2.3
Version: Apache 0.8.3 (and maybe earlier 0.8 versions)
Description:
* Setting ServerRoot in httpd.conf does not update the complete path
to the error_log, pid_log, resource_config_file or access_config_file
files from their values specificed in an unmodified httpd.h.
* Setting full paths to these files in httpd.h does not work; neither
does it for server_config_file.
Symptoms:
* With this httpd.conf:
# This is the main server configuration file. It is best to
# leave the directives in this file in the order they are in, or
# things may not go the way you'd like. See URL http://hoohoo.ncsa.uiuc.edu/
# for instructions.
# Do NOT simply read the instructions in here without understanding
# what they do, if you are unsure consult the online docs. You have been
# warned.
# Rob McCool (comments, questions to httpd@ncsa.uiuc.edu)
# ServerType is either inetd, or standalone.
ServerType standalone
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
# User/Group: The name (or #number) of the user/group to run httpd as.
User nobody
Group nobody
# ServerAdmin: Your address, where problems with the server should be
# e-mailed.
ServerAdmin drtr@ast.cam.ac.uk
# ServerRoot: The directory the server's config, error, and log files
# are kept in
ServerRoot /data/ukhst2/local/src/httpd_1.3
# ServerName allows you to set a host name which is sent back to clients for
# your server if it's different than the one the program would get (i.e. use
# "www" instead of the host's real name).
#
# Note: You cannot just invent host names and hope they work. The name you
# define here must be a valid DNS name for your host. If you don't understand
# this, ask your network administrator.
ServerName mamba.ast.cam.ac.uk
# set on for 931 logging
IdentityCheck off
Starting apache with
% ./httpd -f /data/ukhst2/local/src/httpd_1.3/conf/httpd.conf
gives:
httpd: could not open document config. file /usr/local/etc/httpd/conf/srm.conf
fopen: No such file or directory
If ResourceConfig is set in httpd.conf, then it goes on to give a similar
error for access.conf.
If AccessConfig is set in httpd.conf, but the ServerType is set to inetd,
then it gives a similar error for error_log.
* Setting full paths in httpd.h, e.g.
#define SERVER_CONFIG_FILE "/data/ukhst2/local/src/httpd_1.3/conf/httpd.conf"
gives:
% ./httpd
httpd: could not open document config. file /usr/local/etc/httpd//data/ukhst2/local/src/httpd_1.3/conf/httpd.conf
Cause:
Apache always pre-pendings server_root to the default values for the
filenames. Thus changing ServerRoot in httpd.conf has no effect on the
full path.
The exception is error_log for server type standalone; as the config files
are read twice, the second time the correct ServerRoot is pre-pended to
the error_log path.
Fix:
Never 'canonicalise' these paths, but leave them as relative paths until
they are about to be used.
A patch is supplied below.
David.
----------------------- Begin file conf.patch -------------------------------
*** http_config.c.orig Wed Jul 19 01:31:44 1995
--- http_config.c Thu Jul 27 11:44:26 1995
***************
*** 691,697 ****
group_id = gname2id(DEFAULT_GROUP);
daemons_to_start = DEFAULT_START_DAEMON;
daemons_max_free = DEFAULT_MAX_DAEMON;
! pid_fname = make_full_path(p, server_root, DEFAULT_PIDLOG);
max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
bind_address.s_addr = htonl(INADDR_ANY);
}
--- 691,697 ----
group_id = gname2id(DEFAULT_GROUP);
daemons_to_start = DEFAULT_START_DAEMON;
daemons_max_free = DEFAULT_MAX_DAEMON;
! pid_fname = DEFAULT_PIDLOG;
max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD;
bind_address.s_addr = htonl(INADDR_ANY);
}
***************
*** 703,711 ****
s->port = DEFAULT_PORT;
s->server_admin = DEFAULT_ADMIN;
s->server_hostname = NULL;
! s->error_fname = make_full_path (p, server_root, DEFAULT_ERRORLOG);
! s->srm_confname = make_full_path (p, server_root,RESOURCE_CONFIG_FILE);
! s->access_confname = make_full_path (p, server_root, ACCESS_CONFIG_FILE);
s->timeout = DEFAULT_TIMEOUT;
s->do_rfc931 = DEFAULT_RFC931;
s->next = NULL;
--- 703,711 ----
s->port = DEFAULT_PORT;
s->server_admin = DEFAULT_ADMIN;
s->server_hostname = NULL;
! s->error_fname = DEFAULT_ERRORLOG;
! s->srm_confname = RESOURCE_CONFIG_FILE;
! s->access_confname = ACCESS_CONFIG_FILE;
s->timeout = DEFAULT_TIMEOUT;
s->do_rfc931 = DEFAULT_RFC931;
s->next = NULL;
*** http_main.c.orig Tue Jul 25 03:01:34 1995
--- http_main.c Thu Jul 27 11:50:34 1995
***************
*** 889,903 ****
server_argv0 = argv[0];
strcpy (server_root, HTTPD_ROOT);
! strcpy (server_confname, make_full_path (pconf, server_root,
! SERVER_CONFIG_FILE));
while((c = getopt(argc,argv,"Xd:f:v")) != -1) {
switch(c) {
case 'd':
strcpy (server_root, optarg);
- strcpy (server_confname, make_full_path (pconf, server_root,
- SERVER_CONFIG_FILE));
break;
case 'f':
strcpy (server_confname, optarg);
--- 889,900 ----
server_argv0 = argv[0];
strcpy (server_root, HTTPD_ROOT);
! strcpy (server_confname, SERVER_CONFIG_FILE);
while((c = getopt(argc,argv,"Xd:f:v")) != -1) {
switch(c) {
case 'd':
strcpy (server_root, optarg);
break;
case 'f':
strcpy (server_confname, optarg);
----------------------- End file conf.patch -------------------------------