File | Date | Author | Commit |
---|---|---|---|
Debian sources | 2025-02-27 |
![]() |
[c4fb17] Updating to beta 2. Adding HTTP/2 support. |
.gitignore | 2025-02-21 |
![]() |
[9c056e] Adding docstrings. Minor refactoring. |
LICENSE | 2025-02-21 |
![]() |
[454bd1] Adding GPL v3.0 document |
README.md | 2025-02-27 |
![]() |
[c4fb17] Updating to beta 2. Adding HTTP/2 support. |
VirtualHostAdd_Logo.png | 2025-02-27 |
![]() |
[c4fb17] Updating to beta 2. Adding HTTP/2 support. |
build.sh | 2025-02-21 |
![]() |
[a2a073] Proofreading manual page |
vhostadd.8 | 2025-02-27 |
![]() |
[c4fb17] Updating to beta 2. Adding HTTP/2 support. |
vhostadd_2.2~beta2_all.deb | 2025-02-27 |
![]() |
[c4fb17] Updating to beta 2. Adding HTTP/2 support. |
VirtualHostAdd is a command-line tool for Debian 12—and derived Linux distributions—designed to simplify the creation and configuration of virtual hosts on the Apache HTTP Server, for PHP and CGI-based applications. It automates the entire process, handling directory structure, Apache configuration, MPM and Apache modules handling, and file/directory permissions, reducing manual setup time and errors for developers and sysadmins.
PHP FastCGI
, allowing seamless and fast execution of PHP applications.cgi
module, setting up a Python front controller by default that can be adapted to other scripting languages such as Perl, Ruby, or Bash, among others.🔹 Automatically generates the necessary Apache configuration files based on the selected application type.
🔹 Creates a structured and organised web directory with a standardised setup.
🔹 Ensures proper permissions for web directories and files, avoiding common access issues.
🔹 Simplifies SSL/TLS setup by allowing easy certificate integration with Let’s Encrypt.
🔹 Supports both PHP and CGI-based applications, ensuring seamless integration and execution for web applications.
🔹 Flexible CGI configuration, making it easy to replace Python with any other scripting language.
🔹 Optionally converts the root directory into a Bazaar repository to facilitate simplified deployment.
# Download the latest Debian package
wget https://gitlab.com/eugeniabahit/virtualhostadd/-/raw/v2.2-beta/vhostadd_2.2~beta2_all.deb
# Install the vhostadd command-line tool
sudo apt install ./vhostadd_2.2~beta2_all.deb
Requirements:
- apache2, python3 (>=3.11), php (>=7), tree, python3-pip
Optional:
- bzr
Clone the GitLab repository with SSH:
git clone git@gitlab.com:eugeniabahit/virtualhostadd.git
Usage:
cd Debian\ sources/sbin
sudo ./vhostadd
To build a Debian package execute build.sh
:
./build.sh
vhostadd [{-h,--help}] [{-h,--version}] -s HOST [-l {php,python,cgi}] [-tls] [--h2={true,false}]
-s
(mandatory) → Specifies the hostname of the virtual host.-l
(optional) → Defines the language to create a language-based virtual host. Default: php
.php
, py
, or cgi
(where python
and cgi
are synonyms).-tls
(optional) → If present, adds a Let’s Encrypt certificate for the virtual host. Default: false
.--h2
(optional) → Disables HTTP/2 compatibility when set to false
. Default: true
.vhostadd -s mynewhost.com
vhostadd -s subdomain.mynewhost.com
vhostadd -s mynewhost.com -l python
vhostadd -s mynewhost.com -l cgi
vhostadd -s mynewhost.com -l php
vhostadd -s subdomain.mynewhost.com -l php
vhostadd -s mynewhost.com -tls
vhostadd -s mynewhost.com -l cgi -tls
vhostadd -s subdomain.mynewhost.com -l php -tls
vhostadd -s mynewhost.com --h2=false
vhostadd -s mynewhost.com -l cgi --h2=false
vhostadd -s subdomain.mynewhost.com -l php --h2=false
Note that the following two directives are equivalent since the default value of --h2
is true
.
vhostadd -s mynewhost.com -l cgi -tls --h2=true
vhostadd -s mynewhost.com -l cgi -tls
To access the built-in help documentation, run:
vhostadd --help
To read the manual page for VirtualHostAdd, use:
man vhostadd
To remove VirtualHostAdd from your system, run:
sudo apt remove vhostadd
If you installed VirtualHostAdd manually via dpkg
, remove it with:
sudo dpkg --remove vhostadd
VirtualHostAdd is licensed under the GNU General Public License v3.0 or later. See the LICENSE
file for details.