Apache/2.4.7 (Ubuntu) Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) safemode : OFF MySQL: ON | Perl: ON | cURL: OFF | WGet: ON > / usr / share / doc / apache2 / | server ip : 104.21.89.46 your ip : 172.70.80.62 H O M E |
Filename | /usr/share/doc/apache2/README.multiple-instances |
Size | 3.28 kb |
Permission | rw-r--r-- |
Owner | root : root |
Create time | 27-Apr-2025 10:07 |
Last modified | 26-Nov-2018 20:08 |
Last accessed | 06-Jul-2025 21:28 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
Setup
=====
The scripts apache2ctl, a2enmod, a2ensite, ... and the init script have some
support for handling multiple instances of apache2 running on the same machine.
The basic idea is to copy /etc/apache2 to /etc/apache2-xxx. An example script
that demonstrates what else needs to be done can be found in
/usr/share/doc/apache2/examples/setup-instance. Use with:
sh /usr/share/doc/apache2/examples/setup-instance xxx
Adjust the configuration in /etc/apache2-xxx, especially the listen ports in
ports.conf and in the virtual host directives in
/etc/apache2-xxx/sites-enabled/*.
You can then use a2enmod-xxx, /etc/init.d/apache2-xxx, ... as usual, and they
will affect the new instance of apache2.
To start the new apache2 instance on boot, use
- if you use dependency based boot sequence (the default):
If you don't have ssl keys with passphrases, you may want to set
'X-Interactive: false' in /etc/init.d/apache2-xxx to reduce boot time.
Then execute:
insserv apache2-xxx
- otherwise:
ln -s ../init.d/apache2-xxx /etc/rc2.d/S80apache2-xxx
To make 'apache2ctl-xxx status' work, you need to set APACHE_STATUSURL in
/etc/apache2-xxx/envvars.
Upgrades
========
Since only the configuration files in /etc/apache2 are in the package, the
configuration of other instances won't change if the default configuration
changes. Possibly ways to deal with this are:
- Use symlinks to the files in /etc/apache2 where possible instead of copying
the files.
- Don't modify /etc/apache2 at all but use it to track the default
configuration. You can then merge the changes into the /etc/apache2-xxx dirs.
It may be a good idea to use a version control system for /etc/apache2 to
keep track of the changes. See the package etckeeper for keeping the whole
/etc dir under version control.
An advanced scheme may be for every /etc/apache2* dir to be a separate git
repository so that you can easily pull/push changes from one dir to another.
Package removal
===============
The Apache 2 package will only remove the default configuration files and
directories.
Configuration
=============
The init script will try to read /etc/defaults/apache2-xxx. If that does not
exist, it will use /etc/defaults/apache2 instead.
The following environment variables can be used to influence the scripts. The
default apache2 configuration will make use of them, too. Most can be set in
/etc/apache2-xxx/envvars. Variables set in /etc/apache2-xxx/envvars must be
exported.
variable default value
-------- -------------
APACHE_CONFDIR /etc/apache2 or /etc/apache2-xxx
APACHE_ENVVARS $APACHE_CONFDIR/envvars
APACHE_HTTPD /usr/sbin/apache2
APACHE_ARGUMENTS empty if $APACHE_CONFDIR = /etc/apache2
"-d $APACHE_CONFDIR" otherwise
APACHE_RUN_USER www-data
APACHE_RUN_GROUP www-data
APACHE_PID_FILE /var/run/apache2.pid or /var/run/apachd2-xxx.pid
APACHE_RUN_DIR /var/run/apache2 or /var/run/apache2-xxx
APACHE_LOCK_DIR /var/lock/apache2 or /var/lock/apache2-xxx
APACHE_LOG_DIR /var/log/apache2 or /var/log/apache2-xxx
APACHE_MODS_AVAILABLE $APACHE_CONFDIR/mods-available
APACHE_MODS_ENABLED $APACHE_CONFDIR/mods-enabled
APACHE_SITES_AVAILABLE $APACHE_CONFDIR/sites-available
APACHE_SITES_ENABLED $APACHE_CONFDIR/sites-enabled
APACHE_LYNX www-browser -dump
APACHE_STATUSURL http://localhost:80/server-status
=====
The scripts apache2ctl, a2enmod, a2ensite, ... and the init script have some
support for handling multiple instances of apache2 running on the same machine.
The basic idea is to copy /etc/apache2 to /etc/apache2-xxx. An example script
that demonstrates what else needs to be done can be found in
/usr/share/doc/apache2/examples/setup-instance. Use with:
sh /usr/share/doc/apache2/examples/setup-instance xxx
Adjust the configuration in /etc/apache2-xxx, especially the listen ports in
ports.conf and in the virtual host directives in
/etc/apache2-xxx/sites-enabled/*.
You can then use a2enmod-xxx, /etc/init.d/apache2-xxx, ... as usual, and they
will affect the new instance of apache2.
To start the new apache2 instance on boot, use
- if you use dependency based boot sequence (the default):
If you don't have ssl keys with passphrases, you may want to set
'X-Interactive: false' in /etc/init.d/apache2-xxx to reduce boot time.
Then execute:
insserv apache2-xxx
- otherwise:
ln -s ../init.d/apache2-xxx /etc/rc2.d/S80apache2-xxx
To make 'apache2ctl-xxx status' work, you need to set APACHE_STATUSURL in
/etc/apache2-xxx/envvars.
Upgrades
========
Since only the configuration files in /etc/apache2 are in the package, the
configuration of other instances won't change if the default configuration
changes. Possibly ways to deal with this are:
- Use symlinks to the files in /etc/apache2 where possible instead of copying
the files.
- Don't modify /etc/apache2 at all but use it to track the default
configuration. You can then merge the changes into the /etc/apache2-xxx dirs.
It may be a good idea to use a version control system for /etc/apache2 to
keep track of the changes. See the package etckeeper for keeping the whole
/etc dir under version control.
An advanced scheme may be for every /etc/apache2* dir to be a separate git
repository so that you can easily pull/push changes from one dir to another.
Package removal
===============
The Apache 2 package will only remove the default configuration files and
directories.
Configuration
=============
The init script will try to read /etc/defaults/apache2-xxx. If that does not
exist, it will use /etc/defaults/apache2 instead.
The following environment variables can be used to influence the scripts. The
default apache2 configuration will make use of them, too. Most can be set in
/etc/apache2-xxx/envvars. Variables set in /etc/apache2-xxx/envvars must be
exported.
variable default value
-------- -------------
APACHE_CONFDIR /etc/apache2 or /etc/apache2-xxx
APACHE_ENVVARS $APACHE_CONFDIR/envvars
APACHE_HTTPD /usr/sbin/apache2
APACHE_ARGUMENTS empty if $APACHE_CONFDIR = /etc/apache2
"-d $APACHE_CONFDIR" otherwise
APACHE_RUN_USER www-data
APACHE_RUN_GROUP www-data
APACHE_PID_FILE /var/run/apache2.pid or /var/run/apachd2-xxx.pid
APACHE_RUN_DIR /var/run/apache2 or /var/run/apache2-xxx
APACHE_LOCK_DIR /var/lock/apache2 or /var/lock/apache2-xxx
APACHE_LOG_DIR /var/log/apache2 or /var/log/apache2-xxx
APACHE_MODS_AVAILABLE $APACHE_CONFDIR/mods-available
APACHE_MODS_ENABLED $APACHE_CONFDIR/mods-enabled
APACHE_SITES_AVAILABLE $APACHE_CONFDIR/sites-available
APACHE_SITES_ENABLED $APACHE_CONFDIR/sites-enabled
APACHE_LYNX www-browser -dump
APACHE_STATUSURL http://localhost:80/server-status