Own Apache Instance for ePages
ePages has its own Apache instance. Other Apache server can run simultaneously if they do not use the same ports as ePages (typically 80 and 443).
The ePages Apache instance was created as described in /Doc/doc/apache2/README.multiple-instances[/usr/share/doc/apache2/README.multiple-instances] (from Debian package apache2).
Resulting files of the ePages Apache instance are stored in the (DEB/RPM) package epages-webconf:
- /etc/apache2-epages/
-
ePages Apache configuration files
- /etc/init.d/apache2-epages
-
ePages Apache start/stop script
- /usr/sbin/apache2ctl-epages
-
ePages Apache control script, used by /etc/init.d/apache2-epages
Apache Configuration Files
ePages Apache Configuration Files
Configuration files are stored in /etc/apache2-epages/:
- /etc/apache2-epages/httpd.conf
-
main config file, includes (directly or indirectly) all other config files
- /etc/apache2-epages/extra/
-
directory with other config files, included by httpd.conf or other config files
- /Doc/doc/apache2/include.txt[/etc/apache2-epages/include.txt]
-
tree showing include relations between config files
- /Doc/doc/apache2/envvars[/etc/apache2-epages/envvars]
-
variable settings, used in config files, start/stop and control script
- /Doc/doc/apache2/magic[/etc/apache2-epages/magic]
-
magic data for mod_mime_magic (originally for file(1) command)
- /Doc/doc/apache2/mime.types[/etc/apache2-epages/mime.types]
-
file maps Internet media types to unique file extension(s)
Customizing ePages Apache Configuration Files
All configuration files use environment variables from /etc/apache2-epages/envvars.
Under normal circumstances it is sufficient to customize /etc/apache2-epages/envvars, other Apache configuration files should not be changed.
Only unchanged Apache configuration files are updated by ePages patches. Changed Apache configuration files are not overwritten by ePages patches. Then, files coming from patch are stored in CONF_FILE.rpmnew.
Environment variables from /etc/apache2-epages/envvars are used in Apache configuration files, start/stop script /etc/init.d/apache2-epages and control script /usr/sbin/apache2ctl-epages.
Apache Environment Variables
Customizing ePages Apache Environment Variables
See /Doc/doc/apache2/envvars[/etc/apache2-epages/envvars] for customizable variables and its description, find for example:
APACHE_PORT=80
APACHE_MODS_DIR="/usr/lib64/httpd/modules"
APACHE_LOG_DIR=/var/log/apache2-epages
Apache must be restarted if /etc/apache2-epages/envvars has changed. Reload is not sufficient.
Using ePages Apache Environment Variables in Configuration
All variables defined by /etc/apache2-epages/envvars can be used in configuration files. Depending on the context the usage format varies.
In standard context environment variables are used as follows (from httpd_main.conf):
Listen ${APACHE_PORT}
LoadModule deflate_module ${APACHE_MODS_DIR}/mod_deflate.so
ErrorLog ${APACHE_LOG_DIR}/error_log
In RewriteRule context environment variables are used as follows (from httpd_mod_rewrite_restapi.conf):
RewriteRule ^(/rs/shops/.*)$ http://%{ENV:EPAGESJ_HOST}:%{ENV:EPAGESJ_PORT}$1 [P]
Using ePages Apache Environment Variables in Scripts
Environment variables in /etc/apache2-epages/envvars are made known to /etc/init.d/apache2-epages and /usr/sbin/apache2ctl-epages by sourcing:
APACHE_ENVVARS=/etc/apache2-epages/envvars
[[ -f $APACHE_ENVVARS ]] && . $APACHE_ENVVARS
/etc/apache2-epages/envvars sources itself /etc/default/epages6 so that all variables defined in /etc/default/epages6 are known to /etc/apache2-epages/envvars, following are used by default:
-
EPAGES_WEBUSER EPAGES_WEBGROUP
-
EPAGES EPAGES_SHARED
-
EPAGES_WEBROOT EPAGES_WEBSECURE
-
MAX_NOFD HTTPD_OPTS
-
EPAGESJ_PORT EPAGESJ_HOST
/etc/apache2-epages/envvars.local
At the end of /etc/apache2-epages/envvars file /etc/apache2-epages/envvars.local is sourced (if exist). envvars.local can be used for redefinition of default variables in envvars specific to host.
Apache Define Directives
Using ePages Apache Defines in Configuration
Defines are switches in configuration files, e.g. (from httpd-vhosts_default.conf):
<IfDefine JSON_LOG>
Include extra/httpd_logssl_json.conf
</IfDefine>
<IfDefine !JSON_LOG>
Include extra/httpd_logssl.conf
</IfDefine>
Defines are set (-D) or unset (-U) as web server options, ePages Apache processes look like:
# ps -ef --forest | grep http[d]
UID PID PPID CMD
root 58622 1 /usr/sbin/httpd -DBASE_ALLOW -DREDHAT -f /etc/apache2-epages/httpd.conf -d /etc/apache2-epages -DSSL -DJSON_LOG -k start
apache 58630 58622 \_ /usr/sbin/httpd -DBASE_ALLOW -DREDHAT -f /etc/apache2-epages/httpd.conf -d /etc/apache2-epages -DSSL -DJSON_LOG -k start
apache 58631 58622 \_ /usr/sbin/httpd -DBASE_ALLOW -DREDHAT -f /etc/apache2-epages/httpd.conf -d /etc/apache2-epages -DSSL -DJSON_LOG -k start
apache 58632 58622 \_ /usr/sbin/httpd -DBASE_ALLOW -DREDHAT -f /etc/apache2-epages/httpd.conf -d /etc/apache2-epages -DSSL -DJSON_LOG -k start
You can set defines:
-
as HTTPD_OPTS in /etc/default/epages6, e.g. HTTPD_OPTS="-DSSL -DJSON_LOG"
-
as APACHE_ARGUMENTS in /etc/apache2-epages/envvars, e.g. APACHE_ARGUMENTS=$HTTPD_OPTS
Defines are handed over to the web server via:
-
/etc/default/epages6 defines HTTPD_OPTS
-
HTTPD_OPTS is used by /etc/apache2-epages/envvars: APACHE_ARGUMENTS=$HTTPD_OPTS
-
APACHE_ARGUMENTS is read when starting Apache by /etc/init.d/apache2-epages
-
/etc/init.d/apache2-epages start runs /usr/sbin/apache2ctl-epages start
-
/usr/sbin/apache2ctl-epages start runs /usr/sbin/apache2 $APACHE_ARGUMENTS -k start
Initial Values for Apache Environment Variables
After installing base package epages-release (and before installing ePages itself) you might change some variables in /etc/sysconfig/epages6 which influence /etc/default/epages6 resp. /etc/apache2-epages/envvars:
- EPAGES_INSTALL_WS_GROUP / EPAGES_INSTALL_WS_GID
-
UNIX group name/ID of the web server user (/etc/default/epages6: EPAGES_WEBGROUP)
- EPAGES_INSTALL_WS_RUNUSER / EPAGES_INSTALL_WS_RUNUID
-
UNIX user name/ID that runs the epages web server (/etc/default/epages6: EPAGES_WEBUSER)
- EPAGES_INSTALL_WS_HOST
-
IP addess or hostname of the web server (/etc/apache2-epages/envvars: APACHE_SERVER_NAME)
- EPAGES_INSTALL_WS_HOSTIP
-
Use this variable only if DNS can’t match IP address and hostname
- EPAGES_INSTALL_WS_PORT
-
Port number of the web server (/etc/apache2-epages/envvars: APACHE_PORT)
- EPAGES_INSTALL_WS_SSL_PORT
-
Port number of the SSL web server (/etc/apache2-epages/envvars: APACHE_SSL_PORT)
- EPAGES_INSTALL_HTTPD_OPTS
-
Web server defines (/etc/default/epages6: HTTPD_OPTS)
After changing /etc/sysconfig/epages6 install epages:
-
Debian: apt-get install epages
-
Redhat: yum install epages
/etc/apache2-epages/envvars.sample
The package epages-webconf does not contain /etc/apache2-epages/envvars but /etc/apache2-epages/envvars.sample. When installing the package, envvars.sample is copied to envvars and then changed accordingly.