PHPackages                             jpuck/avhost - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [DevOps &amp; Deployment](/categories/devops)
4. /
5. jpuck/avhost

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

jpuck/avhost
============

Create Apache 2.4 virtual hosts for Ubuntu

2.5.2(8y ago)024[18 issues](https://github.com/jpuck/avhost/issues)GPL-3.0+PHPPHP ^7.0

Since Nov 23Pushed 8y ago1 watchersCompare

[ Source](https://github.com/jpuck/avhost)[ Packagist](https://packagist.org/packages/jpuck/avhost)[ RSS](/packages/jpuck-avhost/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (4)Versions (19)Used By (0)

Apache Virtual Host Generator
=============================

[](#apache-virtual-host-generator)

[![Build Status](https://camo.githubusercontent.com/209617e8199938503726fa41866e029fcff68ee7c40fb97a6afa9843adb046be/68747470733a2f2f7472617669732d63692e6f72672f6a7075636b2f6176686f73742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/jpuck/avhost)[![Codecov](https://camo.githubusercontent.com/70182876bb3db6191265d630d387c5acabf3f51087a3e692c58055db3a0fec65/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6a7075636b2f6176686f73742f6d61737465722e737667)](https://codecov.io/gh/jpuck/avhost/branch/master)[![Latest Stable Version](https://camo.githubusercontent.com/edb7e27c3c708ca1cb03cd0150e2789bfc3bcf5b307c10cb643d413523306833/68747470733a2f2f706f7365722e707567782e6f72672f6a7075636b2f6176686f73742f762f737461626c65)](https://github.com/jpuck/avhost/releases/latest)[![Total Downloads](https://camo.githubusercontent.com/0e1af78316a4f2fdf1bdeecb50dc056c58913bbc6de3c1ecd4d3d282d8b7ad17/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f646f776e6c6f6164732f6a7075636b2f6176686f73742f746f74616c2e737667)](https://github.com/jpuck/avhost/releases/latest)[![License](https://camo.githubusercontent.com/e57f4af4e858031c665056c5597ce93f3d7554385a6fdc39b9314ddb0fe8181c/68747470733a2f2f706f7365722e707567782e6f72672f6a7075636b2f6176686f73742f6c6963656e7365)](https://github.com/jpuck/avhost/releases/latest)

PHP 7 command line [symfony console application](http://symfony.com/doc/current/components/console.html) to create Apache 2.4 virtual hosts for Ubuntu.

---

Getting Started
---------------

[](#getting-started)

This is an Apache adminstrative tool whose commands mostly require sudo. It can write configuration files to `/etc/apache2/sites-available/` invoke `a2ensite`as well as writing SSL certificates to `/etc/ssl/certs/` and keys to `/etc/ssl/private/`so the best way to install it would be somewhere in root's path.

[Download the latest release](https://github.com/jpuck/avhost/releases/latest), set it executable, and move it to a good path. Here's a oneline command:

```
curl -s -L https://github.com/jpuck/avhost/releases/latest | egrep -o '/jpuck/avhost/releases/download/[0-9\.]*/avhost.phar' | wget --base=http://github.com/ -i - -O avhost && chmod +x avhost && sudo mv avhost /usr/local/bin/

```

After installing, run without any arguments to see a list of commands:

```
avhost

```

Use the `-h` flag with any command to get help with usage:

```
avhost  -h

```

Troubleshooting
===============

[](#troubleshooting)

> Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.

Looking at those logs are certainly helpful, but here are a couple things that might not be obvious the first time:

No ssl
------

[](#no-ssl)

To run an encrypted virtual host over [TLS (SSL)](https://en.wikipedia.org/wiki/Transport_Layer_Security), you must have enabled [Apache Module mod\_ssl](https://httpd.apache.org/docs/2.4/mod/mod_ssl.html).

```
sudo a2enmod ssl

```

No rewrite
----------

[](#no-rewrite)

The default configuration with `avhost` is to redirect all traffic to an encrypted connection when available. This is accomplished with [Apache Module mod\_rewrite](https://httpd.apache.org/docs/current/mod/mod_rewrite.html).

```
sudo a2enmod rewrite

```

[This is recommended](https://www.eff.org/encrypt-the-web) for [many reasons](https://webmasters.googleblog.com/2014/08/https-as-ranking-signal.html). If necessary, this can be overridden by passing the option `--no-require-ssl`which makes sense in some cases, like when using a self-signed certificate that might cause trust issues. However, since you can get a free trusted certificate from [Let's Encrypt](https://letsencrypt.org/), then there's no reason to be using a self-signed certificate on a public site anyway.

403 Forbidden
-------------

[](#403-forbidden)

If you create the document root in some random folder, then not only must that folder and files be readable to Apache, but also every directory up to root must be executable by Apache in order for it to traverse the file system.

For example, if your site's files are in `/path/to/private/web/folder`

```
# up to directory, folders executable
chmod go+X /
chmod go+X /path
chmod go+X /path/to
chmod go+X /path/to/private
chmod go+X /path/to/private/web

# in directory, folders executable, files readable
chmod -R go+rX /path/to/private/web/folder
```

No headers
----------

[](#no-headers)

In order to add protection such as `X-Content-Type-Options "nosniff"` and to remove the `X-Powered-By` information, you must enable [Apache Module mod\_headers](https://httpd.apache.org/docs/2.4/mod/mod_headers.html). This is also needed to allow [Cross Origin Resource Sharing](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS), which is not enabled by this project - you must manually define your CORS headers if you want.

```
sudo a2enmod headers

```

No compression
--------------

[](#no-compression)

For performance reasons, most file types are compressed, but you must have enabled [Apache Module mod\_deflate](https://httpd.apache.org/docs/current/mod/mod_deflate.html).

```
sudo a2enmod deflate

```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~21 days

Recently: every ~51 days

Total

11

Last Release

3247d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4d3f43ad248cd9c696b067b19e4e18856d78a8b2e4f2c3ee21a1d3d5cead5610?d=identicon)[jpuck](/maintainers/jpuck)

---

Top Contributors

[![jpuck](https://avatars.githubusercontent.com/u/15305396?v=4)](https://github.com/jpuck "jpuck (92 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jpuck-avhost/health.svg)

```
[![Health](https://phpackages.com/badges/jpuck-avhost/health.svg)](https://phpackages.com/packages/jpuck-avhost)
```

###  Alternatives

[shopware/deployment-helper

Shopware deployment tools

19305.3k5](/packages/shopware-deployment-helper)[drevops/git-artifact

Package artifact from your codebase in CI and push it to a separate git repo.

2133.2k](/packages/drevops-git-artifact)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
