From: Sander Striker Date: Thu, 4 Apr 2002 09:15:44 +0000 (+0000) Subject: Remove hardcoded paths from MPMs and move them to a more central X-Git-Tag: 2.0.35~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d14107e925d5dbb11c4ab7d008cece271e574955;p=thirdparty%2Fapache%2Fhttpd.git Remove hardcoded paths from MPMs and move them to a more central place. Expand paths in httpd-std.conf in a similar fashion as we do in our headers. Submitted by: Pier Fumagalli git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94431 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/Makefile.in b/Makefile.in index 7d255e0ebf3..d850fecd1af 100644 --- a/Makefile.in +++ b/Makefile.in @@ -20,9 +20,9 @@ INSTALL_TARGETS = install-conf install-htdocs install-error install-icons \ install-other install-cgi install-include install-suexec install-man \ install-build -DISTCLEAN_TARGETS = include/ap_config_auto.h include/ap_config_path.h \ +DISTCLEAN_TARGETS = include/ap_config_auto.h include/ap_config_layout.h \ modules.c config.cache config.log config.status build/config_vars.mk \ - build/rules.mk + build/rules.mk docs/conf/httpd-std.conf EXTRACLEAN_TARGETS = configure include/ap_config_auto.h.in generated_lists include $(top_builddir)/build/rules.mk diff --git a/configure.in b/configure.in index f9d3b0fb30e..9983cb95577 100644 --- a/configure.in +++ b/configure.in @@ -480,7 +480,7 @@ case $host in ;; esac -AC_OUTPUT($APACHE_OUTPUT_FILES support/apxs support/apachectl support/dbmmanage support/envvars-std support/log_server_status support/logresolve.pl support/phf_abuse_log.cgi support/split-logfile build/rules.mk,[true],[ +AC_OUTPUT($APACHE_OUTPUT_FILES docs/conf/httpd-std.conf include/ap_config_layout.h support/apxs support/apachectl support/dbmmanage support/envvars-std support/log_server_status support/logresolve.pl support/phf_abuse_log.cgi support/split-logfile build/rules.mk,[true],[ APACHE_GEN_MAKEFILES ]) diff --git a/docs/conf/httpd-std.conf b/docs/conf/httpd-std.conf.in similarity index 95% rename from docs/conf/httpd-std.conf rename to docs/conf/httpd-std.conf.in index 7a408098d67..b015f27a8fd 100644 --- a/docs/conf/httpd-std.conf +++ b/docs/conf/httpd-std.conf.in @@ -24,9 +24,9 @@ # Configuration and logfile names: If the filenames you specify for many # of the server's control files begin with "/" (or "drive:/" for Win32), the # server will use that explicit path. If the filenames do *not* begin -# with "/", the value of ServerRoot is prepended -- so "logs/foo.log" -# with ServerRoot set to "/usr/local/apache" will be interpreted by the -# server as "/usr/local/apache/logs/foo.log". +# with "/", the value of ServerRoot is prepended -- so "@rel_logfiledir@/foo.log" +# with ServerRoot set to "@@ServerRoot@@" will be interpreted by the +# server as "@@ServerRoot@@/@rel_logfiledir@/foo.log". # ### Section 1: Global Environment @@ -54,7 +54,7 @@ ServerRoot "@@ServerRoot@@" # -#LockFile logs/accept.lock +#LockFile @rel_logfiledir@/accept.lock @@ -68,7 +68,7 @@ ServerRoot "@@ServerRoot@@" # -#ScoreBoardFile logs/apache_runtime_status +#ScoreBoardFile @rel_logfiledir@/apache_runtime_status @@ -78,7 +78,7 @@ ServerRoot "@@ServerRoot@@" # identification number when it starts. # -PidFile logs/httpd.pid +PidFile @rel_logfiledir@/httpd.pid # @@ -290,7 +290,7 @@ UseCanonicalName Off # documents. By default, all requests are taken from this directory, but # symbolic links and aliases may be used to point to other locations. # -DocumentRoot "@@ServerRoot@@/htdocs" +DocumentRoot "@@ServerRoot@@/@rel_htdocsdir@" # # Each directory to which Apache has access can be configured with respect @@ -315,7 +315,7 @@ DocumentRoot "@@ServerRoot@@/htdocs" # # This should be changed to whatever you set DocumentRoot to. # - + # # Possible values for the Options directive are "None", "All", @@ -398,7 +398,7 @@ AccessFileName .htaccess # TypesConfig describes where the mime.types file (or equivalent) is # to be found. # -TypesConfig conf/mime.types +TypesConfig @rel_sysconfdir@/mime.types # # DefaultType is the default MIME type the server will use for a document @@ -417,7 +417,7 @@ DefaultType text/plain # directive tells the module where the hint definitions are located. # - MIMEMagicFile conf/magic + MIMEMagicFile @rel_sysconfdir@/magic # @@ -437,7 +437,7 @@ HostnameLookups Off # logged here. If you *do* define an error logfile for a # container, that host's errors will be logged there and not here. # -ErrorLog logs/error_log +ErrorLog @rel_logfiledir@/error_log # # LogLevel: Control the number of messages logged to the error_log. @@ -462,20 +462,20 @@ LogFormat "%{User-agent}i" agent # define per- access logfiles, transactions will be # logged therein and *not* in this file. # -CustomLog logs/access_log common +CustomLog @rel_logfiledir@/access_log common # # If you would like to have agent and referer logfiles, uncomment the # following directives. # -#CustomLog logs/referer_log referer -#CustomLog logs/agent_log agent +#CustomLog @rel_logfiledir@/referer_log referer +#CustomLog @rel_logfiledir@/agent_log agent # # If you prefer a single logfile with access, agent, and referer information # (Combined Logfile Format) you can use the following directive. # -#CustomLog logs/access_log combined +#CustomLog @rel_logfiledir@/access_log combined # # Optionally add a line containing the server version and virtual host @@ -499,9 +499,9 @@ ServerSignature On # We include the /icons/ alias for FancyIndexed directory listings. If you # do not use FancyIndexing, you may comment this out. # -Alias /icons/ "@@ServerRoot@@/icons/" +Alias /icons/ "@@ServerRoot@@/@rel_iconsdir@/" - + Options Indexes MultiViews AllowOverride None Order allow,deny @@ -513,9 +513,9 @@ Alias /icons/ "@@ServerRoot@@/icons/" # the manual, even if you choose to move your DocumentRoot. You may comment # this out if you do not care for the documentation. # -Alias /manual "@@ServerRoot@@/manual" +Alias /manual "@@ServerRoot@@/@rel_manualdir@" - + Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny @@ -530,21 +530,21 @@ Alias /manual "@@ServerRoot@@/manual" # The same rules about trailing "/" apply to ScriptAlias directives as to # Alias. # -ScriptAlias /cgi-bin/ "@@ServerRoot@@/cgi-bin/" +ScriptAlias /cgi-bin/ "@@ServerRoot@@/@rel_cgidir@/" # # Additional to mod_cgid.c settings, mod_cgid has Scriptsock # for setting UNIX socket for communicating with cgid. # -#Scriptsock logs/cgisock +#Scriptsock @rel_runtimedir@/cgisock # -# "@@ServerRoot@@/cgi-bin" should be changed to whatever your ScriptAliased +# "@@ServerRoot@@/@rel_cgidir@" should be changed to whatever your ScriptAliased # CGI directory exists, if you have that configured. # - + AllowOverride None Options None Order allow,deny @@ -854,15 +854,15 @@ AddHandler type-map var # Alias /error/include/ "/your/include/path/" # # which allows you to create your own set of files by starting with the -# @@ServerRoot@@/error/include/ files and +# @@ServerRoot@@/@rel_errordir@/include/ files and # copying them to /your/include/path/, even on a per-VirtualHost basis. # - Alias /error/ "@@ServerRoot@@/error/" + Alias /error/ "@@ServerRoot@@/@rel_errordir@/" - + AllowOverride None Options IncludesNoExec AddOutputFilter Includes html @@ -960,7 +960,7 @@ BrowserMatch "^WebDrive" redirect-carefully # To enable the cache as well, edit and uncomment the following lines: # (no cacheing without CacheRoot) # -#CacheRoot "@@ServerRoot@@/proxy" +#CacheRoot "@@ServerRoot@@/@rel_proxycachedir@" #CacheSize 5 #CacheGcInterval 4 #CacheMaxExpire 24 @@ -975,7 +975,7 @@ BrowserMatch "^WebDrive" redirect-carefully # Bring in additional module-specific configurations # - Include conf/ssl.conf + Include @rel_sysconfdir@/ssl.conf @@ -1008,6 +1008,6 @@ BrowserMatch "^WebDrive" redirect-carefully # ServerAdmin webmaster@dummy-host.example.com # DocumentRoot /www/docs/dummy-host.example.com # ServerName dummy-host.example.com -# ErrorLog logs/dummy-host.example.com-error_log -# CustomLog logs/dummy-host.example.com-access_log common +# ErrorLog @rel_logfiledir@/dummy-host.example.com-error_log +# CustomLog @rel_logfiledir@/dummy-host.example.com-access_log common # diff --git a/include/ap_config.h b/include/ap_config.h index f72fa9f5df6..bc503da670a 100644 --- a/include/ap_config.h +++ b/include/ap_config.h @@ -268,9 +268,9 @@ #include "os.h" #if !defined(WIN32) && !defined(NETWARE) #include "ap_config_auto.h" +#include "ap_config_layout.h" #endif - /* TODO - We need to put OS detection back to make all the following work */ #if defined(SUNOS4) || defined(IRIX) || defined(NEXT) || defined(AUX3) \ diff --git a/include/ap_config_layout.h.in b/include/ap_config_layout.h.in new file mode 100644 index 00000000000..08f1de1d35c --- /dev/null +++ b/include/ap_config_layout.h.in @@ -0,0 +1,97 @@ +/* ==================================================================== + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Apache" and "Apache Software Foundation" must + * not be used to endorse or promote products derived from this + * software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache", + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + */ + +#ifndef AP_CONFIG_LAYOUT_H +#define AP_CONFIG_LAYOUT_H + +/* Configured Apache directory layout */ +#define DEFAULT_PREFIX "@prefix@" +#define DEFAULT_EXP_EXEC_PREFIX "@exp_exec_prefix@" +#define DEFAULT_REL_EXEC_PREFIX "@rel_exec_prefix@" +#define DEFAULT_EXP_BINDIR "@exp_bindir@" +#define DEFAULT_REL_BINDIR "@rel_bindir@" +#define DEFAULT_EXP_SBINDIR "@exp_sbindir@" +#define DEFAULT_REL_SBINDIR "@rel_sbindir@" +#define DEFAULT_EXP_LIBEXECDIR "@exp_libexecdir@" +#define DEFAULT_REL_LIBEXECDIR "@rel_libexecdir@" +#define DEFAULT_EXP_MANDIR "@exp_mandir@" +#define DEFAULT_REL_MANDIR "@rel_mandir@" +#define DEFAULT_EXP_SYSCONFDIR "@exp_sysconfdir@" +#define DEFAULT_REL_SYSCONFDIR "@rel_sysconfdir@" +#define DEFAULT_EXP_DATADIR "@exp_datadir@" +#define DEFAULT_REL_DATADIR "@rel_datadir@" +#define DEFAULT_EXP_INSTALLBUILDDIR "@exp_installbuilddir@" +#define DEFAULT_REL_INSTALLBUILDDIR "@rel_installbuilddir@" +#define DEFAULT_EXP_ERRORDIR "@exp_errordir@" +#define DEFAULT_REL_ERRORDIR "@rel_errordir@" +#define DEFAULT_EXP_ICONSDIR "@exp_iconsdir@" +#define DEFAULT_REL_ICONSDIR "@rel_iconsdir@" +#define DEFAULT_EXP_HTDOCSDIR "@exp_htdocsdir@" +#define DEFAULT_REL_HTDOCSDIR "@rel_htdocsdir@" +#define DEFAULT_EXP_MANUALDIR "@exp_manualdir@" +#define DEFAULT_REL_MANUALDIR "@rel_manualdir@" +#define DEFAULT_EXP_CGIDIR "@exp_cgidir@" +#define DEFAULT_REL_CGIDIR "@rel_cgidir@" +#define DEFAULT_EXP_INCLUDEDIR "@exp_includedir@" +#define DEFAULT_REL_INCLUDEDIR "@rel_includedir@" +#define DEFAULT_EXP_LOCALSTATEDIR "@exp_localstatedir@" +#define DEFAULT_REL_LOCALSTATEDIR "@rel_localstatedir@" +#define DEFAULT_EXP_RUNTIMEDIR "@exp_runtimedir@" +#define DEFAULT_REL_RUNTIMEDIR "@rel_runtimedir@" +#define DEFAULT_EXP_LOGFILEDIR "@exp_logfiledir@" +#define DEFAULT_REL_LOGFILEDIR "@rel_logfiledir@" +#define DEFAULT_EXP_PROXYCACHEDIR "@exp_proxycachedir@" +#define DEFAULT_REL_PROXYCACHEDIR "@rel_proxycachedir@" + +#endif /* AP_CONFIG_LAYOUT_H */ diff --git a/modules/generators/mod_cgid.c b/modules/generators/mod_cgid.c index b5c983b2b89..7cc2aba4faf 100644 --- a/modules/generators/mod_cgid.c +++ b/modules/generators/mod_cgid.c @@ -149,7 +149,7 @@ static int is_scriptaliased(request_rec *r) #define DEFAULT_LOGBYTES 10385760 #define DEFAULT_BUFBYTES 1024 -#define DEFAULT_SOCKET "logs/cgisock" +#define DEFAULT_SOCKET DEFAULT_REL_RUNTIMEDIR "/cgisock" #define CGI_REQ 1 #define SSI_REQ 2 diff --git a/server/mpm/beos/mpm_default.h b/server/mpm/beos/mpm_default.h index 8de87c3cbb1..586ec34b2b9 100644 --- a/server/mpm/beos/mpm_default.h +++ b/server/mpm/beos/mpm_default.h @@ -98,7 +98,7 @@ /* Where the main/parent process's pid is logged */ #ifndef DEFAULT_PIDLOG -#define DEFAULT_PIDLOG "logs/httpd.pid" +#define DEFAULT_PIDLOG DEFAULT_REL_RUNTIMEDIR "/httpd.pid" #endif /* diff --git a/server/mpm/experimental/perchild/mpm_default.h b/server/mpm/experimental/perchild/mpm_default.h index 2874b347c39..48ce224629a 100644 --- a/server/mpm/experimental/perchild/mpm_default.h +++ b/server/mpm/experimental/perchild/mpm_default.h @@ -88,12 +88,12 @@ /* File used for accept locking, when we use a file */ #ifndef DEFAULT_LOCKFILE -#define DEFAULT_LOCKFILE "logs/accept.lock" +#define DEFAULT_LOCKFILE DEFAULT_REL_RUNTIMEDIR "/accept.lock" #endif /* Where the main/parent process's pid is logged */ #ifndef DEFAULT_PIDLOG -#define DEFAULT_PIDLOG "logs/httpd.pid" +#define DEFAULT_PIDLOG DEFAULT_REL_RUNTIMEDIR "/httpd.pid" #endif /* diff --git a/server/mpm/mpmt_os2/mpm_default.h b/server/mpm/mpmt_os2/mpm_default.h index 7ac40ab42e9..3bf64a107a7 100644 --- a/server/mpm/mpmt_os2/mpm_default.h +++ b/server/mpm/mpmt_os2/mpm_default.h @@ -81,7 +81,7 @@ /* Where the main/parent process's pid is logged */ #ifndef DEFAULT_PIDLOG -#define DEFAULT_PIDLOG "logs/httpd.pid" +#define DEFAULT_PIDLOG DEFAULT_REL_RUNTIMEDIR "/httpd.pid" #endif /* diff --git a/server/mpm/netware/mpm_default.h b/server/mpm/netware/mpm_default.h index 69348751adf..e1e864e7425 100644 --- a/server/mpm/netware/mpm_default.h +++ b/server/mpm/netware/mpm_default.h @@ -116,15 +116,20 @@ #define DEFAULT_MIN_FREE_THREADS 10 #endif +/* Check for definition of DEFAULT_REL_RUNTIMEDIR */ +#ifndef DEFAULT_REL_RUNTIMEDIR +#define DEFAULT_REL_RUNTIMEDIR "logs" +#endif + /* File used for accept locking, when we use a file */ /*#ifndef DEFAULT_LOCKFILE - #define DEFAULT_LOCKFILE "logs/accept.lock" + #define DEFAULT_LOCKFILE DEFAULT_REL_RUNTIMEDIR "/accept.lock" #endif */ /* Where the main/parent process's pid is logged */ /*#ifndef DEFAULT_PIDLOG - #define DEFAULT_PIDLOG "logs/httpd.pid" + #define DEFAULT_PIDLOG DEFAULT_REL_RUNTIMEDIR "/httpd.pid" #endif */ diff --git a/server/mpm/perchild/mpm_default.h b/server/mpm/perchild/mpm_default.h index 2874b347c39..48ce224629a 100644 --- a/server/mpm/perchild/mpm_default.h +++ b/server/mpm/perchild/mpm_default.h @@ -88,12 +88,12 @@ /* File used for accept locking, when we use a file */ #ifndef DEFAULT_LOCKFILE -#define DEFAULT_LOCKFILE "logs/accept.lock" +#define DEFAULT_LOCKFILE DEFAULT_REL_RUNTIMEDIR "/accept.lock" #endif /* Where the main/parent process's pid is logged */ #ifndef DEFAULT_PIDLOG -#define DEFAULT_PIDLOG "logs/httpd.pid" +#define DEFAULT_PIDLOG DEFAULT_REL_RUNTIMEDIR "/httpd.pid" #endif /* diff --git a/server/mpm/prefork/mpm_default.h b/server/mpm/prefork/mpm_default.h index cd5cb38a361..54057ed3ef2 100644 --- a/server/mpm/prefork/mpm_default.h +++ b/server/mpm/prefork/mpm_default.h @@ -82,12 +82,12 @@ /* File used for accept locking, when we use a file */ #ifndef DEFAULT_LOCKFILE -#define DEFAULT_LOCKFILE "logs/accept.lock" +#define DEFAULT_LOCKFILE DEFAULT_REL_RUNTIMEDIR "/accept.lock" #endif /* Where the main/parent process's pid is logged */ #ifndef DEFAULT_PIDLOG -#define DEFAULT_PIDLOG "logs/httpd.pid" +#define DEFAULT_PIDLOG DEFAULT_REL_RUNTIMEDIR "/httpd.pid" #endif /* diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c index 1aaf0551171..f74720e4daf 100644 --- a/server/mpm/prefork/prefork.c +++ b/server/mpm/prefork/prefork.c @@ -184,8 +184,8 @@ static int die_now = 0; /* * change directory for gprof to plop the gmon.out file * configure in httpd.conf: - * GprofDir logs/ -> $ServerRoot/logs/gmon.out - * GprofDir logs/% -> $ServerRoot/logs/gprof.$pid/gmon.out + * GprofDir $RuntimeDir/ -> $ServerRoot/$RuntimeDir/gmon.out + * GprofDir $RuntimeDir/% -> $ServerRoot/$RuntimeDir/gprof.$pid/gmon.out */ static void chdir_for_gprof(void) { @@ -210,7 +210,7 @@ static void chdir_for_gprof(void) } } else { - use_dir = ap_server_root_relative(pconf, "logs"); + use_dir = ap_server_root_relative(pconf, DEFAULT_REL_RUNTIMEDIR); } chdir(use_dir); diff --git a/server/mpm/winnt/mpm_default.h b/server/mpm/winnt/mpm_default.h index 7121298fb2b..4ae413b914f 100644 --- a/server/mpm/winnt/mpm_default.h +++ b/server/mpm/winnt/mpm_default.h @@ -86,9 +86,14 @@ #define DEFAULT_NUM_DAEMON 1 #endif +/* Check for definition of DEFAULT_REL_RUNTIMEDIR */ +#ifndef DEFAULT_REL_RUNTIMEDIR +#define DEFAULT_REL_RUNTIMEDIR "logs" +#endif + /* Where the main/parent process's pid is logged */ #ifndef DEFAULT_PIDLOG -#define DEFAULT_PIDLOG "logs/httpd.pid" +#define DEFAULT_PIDLOG DEFAULT_REL_RUNTIMEDIR "/httpd.pid" #endif /* diff --git a/server/mpm/worker/mpm_default.h b/server/mpm/worker/mpm_default.h index b24fd177e04..73be58a6096 100644 --- a/server/mpm/worker/mpm_default.h +++ b/server/mpm/worker/mpm_default.h @@ -86,12 +86,12 @@ /* File used for accept locking, when we use a file */ #ifndef DEFAULT_LOCKFILE -#define DEFAULT_LOCKFILE "logs/accept.lock" +#define DEFAULT_LOCKFILE DEFAULT_REL_RUNTIMEDIR "/accept.lock" #endif /* Where the main/parent process's pid is logged */ #ifndef DEFAULT_PIDLOG -#define DEFAULT_PIDLOG "logs/httpd.pid" +#define DEFAULT_PIDLOG DEFAULT_REL_RUNTIMEDIR "/httpd.pid" #endif /* diff --git a/support/apachectl.in b/support/apachectl.in index e4496a1ac32..b8c9ee659da 100644 --- a/support/apachectl.in +++ b/support/apachectl.in @@ -26,14 +26,14 @@ ARGV="$@" # -------------------- -------------------- # # the path to your PID file -PIDFILE=@prefix@/logs/@progname@.pid +PIDFILE=@exp_runtimedir@/@progname@.pid # # the path to your httpd binary, including options if necessary -HTTPD='@prefix@/bin/@progname@' +HTTPD='@exp_bindir@/@progname@' # # pick up any necessary environment variables -if test -f @prefix@/bin/envvars; then - . @prefix@/bin/envvars +if test -f @exp_bindir@/envvars; then + . @exp_bindir@/envvars fi # # a command that outputs a formatted text version of the HTML at the