Menu

Tree [c4fb17] v2.2-beta v2.2-beta2 /
 History

HTTPS access


File Date Author Commit
 Debian sources 2025-02-27 Eugenia Bahit Eugenia Bahit [c4fb17] Updating to beta 2. Adding HTTP/2 support.
 .gitignore 2025-02-21 Eugenia Bahit Eugenia Bahit [9c056e] Adding docstrings. Minor refactoring.
 LICENSE 2025-02-21 Eugenia Bahit Eugenia Bahit [454bd1] Adding GPL v3.0 document
 README.md 2025-02-27 Eugenia Bahit Eugenia Bahit [c4fb17] Updating to beta 2. Adding HTTP/2 support.
 VirtualHostAdd_Logo.png 2025-02-27 Eugenia Bahit Eugenia Bahit [c4fb17] Updating to beta 2. Adding HTTP/2 support.
 build.sh 2025-02-21 Eugenia Bahit Eugenia Bahit [a2a073] Proofreading manual page
 vhostadd.8 2025-02-27 Eugenia Bahit Eugenia Bahit [c4fb17] Updating to beta 2. Adding HTTP/2 support.
 vhostadd_2.2~beta2_all.deb 2025-02-27 Eugenia Bahit Eugenia Bahit [c4fb17] Updating to beta 2. Adding HTTP/2 support.

Read Me

Overview

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.

Types of virtual hosts supported:

  1. PHP-based virtual hosts: configured to use PHP FastCGI, allowing seamless and fast execution of PHP applications.
  2. CGI-based virtual hosts: configured using the Apache 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.

Features

🔹 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.

Installation

Installation from the Debian package

# 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

Manual Installation

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

Usage

Syntax

vhostadd [{-h,--help}] [{-h,--version}] -s HOST [-l {php,python,cgi}] [-tls] [--h2={true,false}]

Options:

  • -s (mandatory) → Specifies the hostname of the virtual host.
  • -l (optional) → Defines the language to create a language-based virtual host. Default: php.
    • Accepts 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.

Examples

Adding a new CGI-based virtual host:

vhostadd -s mynewhost.com
vhostadd -s subdomain.mynewhost.com
vhostadd -s mynewhost.com -l python
vhostadd -s mynewhost.com -l cgi

Adding a new PHP-based virtual host:

vhostadd -s mynewhost.com -l php
vhostadd -s subdomain.mynewhost.com -l php

Adding a new Let’s Encrypt signed virtual host:

vhostadd -s mynewhost.com -tls
vhostadd -s mynewhost.com -l cgi -tls
vhostadd -s subdomain.mynewhost.com -l php -tls

Disabling HTTP/2 Compatibility

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

Getting Help

To access the built-in help documentation, run:

vhostadd --help

To read the manual page for VirtualHostAdd, use:

man vhostadd

Uninstallation

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

Licence

VirtualHostAdd is licensed under the GNU General Public License v3.0 or later. See the LICENSE file for details.

Author

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.