Skip to content

User specific virtual host configuration tools for use with apache2

License

Notifications You must be signed in to change notification settings

Adspectus/vhostmanager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vhostmanager

GitHub tag (latest by date) GitHub issues GitHub license

The vhostmanager package is a collection of configuration files and scripts to enable a user specific Apache2 configuration. It provides the optional inclusion of configurations and virtual host definitions from directories in $HOME/apache2. Furthermore it provides scripts to manage these configuration files in a similar way like the standard tools provided by the apache2 package.

Contents

Getting Started

Prerequisites

  • Debian based OS
  • Apache2 Webserver > 2.4
  • Perl 5

Installation

See the installation instructions in INSTALL.md.

After installation of the package, create the directories for your personal configuration files with:

$ mkdir -p $HOME/apache2/{conf,sites}-{available,enabled}

Usage

After installation and creating the directories you should have the following directory structure in your home directory:

$HOME/apache2/
├── conf-available/
├── conf-enabled/
├── sites-available/
└── sites-enabled/

Apache2 will include all configurations files (ending in .conf) from the $HOME/apache2/conf-enabled and the $HOME/apache2/sites-enabled directory of all users, if there are any. Note, that the users home directories are expected to be in /home/!

Like within the main Apache2 directory, the real files should be placed into the $HOME/apache2/conf-available and the $HOME/apache2/sites-available directory resp. and only symlinked to the *-enabled directories if they should be active.

The activation and deactivation of configurations and virtual hosts can be done by the provided commands vhostenconf, vhostdisconf, vhostensite, and vhostdissite just like their counterparts a2enconf, a2disconf, a2ensite, and a2dissite from the apache2 package, which are limited to the main Apache2 directory though.

Like their counterparts, the vhost*commands work with tab-completion and for your convenience you can list i.e. all enabled sites with the command vhostquery -s (like a2query -s for the main Apache2 sites).

User specific virtual hosts directory

Of course, after installation of this package it might also makes sense to place the root of user specific virtual hosts into a user defined directory as well.

This decision is left to the user, however $HOME/public_html would not be a good choice since it is already reserved for the per-user web-directory in Apache2 (if enabled). Instead, $HOME/vhosts might be a reasonable option.

Whatever you choose, it might be necessary to open permissions for the user specific virtual host root folder, because under the default security model of the Apache2 server it is not allowed to access the root filesystem outside of /usr/share and /var/www resp. Hence, you will likely create a configuration file in your conf-available directory with at least the following lines, assuming the virtual host root folder is $HOME/vhosts (replace <HOMEDIR> with the real path of your home directory):

<Directory <HOMEDIR>/vhosts>
  Options Indexes FollowSymLinks
  AllowOverride None
  Require all granted
</Directory>

The /usr/share/doc/vhostmanager/examples directory contains an example configuration in the file vhostmanager.conf with this and some more example configuration directives which might further simplify your life.

For more help, please refer to the man page of each command.

License

Apache License 2.0

Acknowledgements

  • a2enmod by Stefan Fritsch
  • a2query by Arno Töll

About

User specific virtual host configuration tools for use with apache2

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages