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 /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:


ePages Apache configuration files


ePages Apache start/stop script


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/:


main config file, includes (directly or indirectly) all other config files


directory with other config files, included by httpd.conf or other config files


tree showing include relations between config files


variable settings, used in config files, start/stop and control script


magic data for mod_mime_magic (originally for file(1) command)


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 /etc/apache2-epages/envvars for customizable variables and its description, find for example:


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):

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:


/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:







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 !JSON_LOG>
  Include extra/httpd_logssl.conf

Defines are set (-D) or unset (-U) as web server options, ePages Apache processes look like:

# ps -ef --forest | grep http[d]
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:

  1. /etc/default/epages6 defines HTTPD_OPTS

  2. HTTPD_OPTS is used by /etc/apache2-epages/envvars: APACHE_ARGUMENTS=$HTTPD_OPTS

  3. APACHE_ARGUMENTS is read when starting Apache by /etc/init.d/apache2-epages

  4. /etc/init.d/apache2-epages start runs /usr/sbin/apache2ctl-epages start

  5. /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:


UNIX group name/ID of the web server user (/etc/default/epages6: EPAGES_WEBGROUP)


UNIX user name/ID that runs the epages web server (/etc/default/epages6: EPAGES_WEBUSER)


IP addess or hostname of the web server (/etc/apache2-epages/envvars: APACHE_SERVER_NAME)


Use this variable only if DNS can’t match IP address and hostname


Port number of the web server (/etc/apache2-epages/envvars: APACHE_PORT)


Port number of the SSL web server (/etc/apache2-epages/envvars: APACHE_SSL_PORT)


Web server defines (/etc/default/epages6: HTTPD_OPTS)

After changing /etc/sysconfig/epages6 install epages:

  • Debian: apt-get install epages

  • Redhat: yum install epages


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.