https://github.com/tetreum/vhostmanager
Virtual host manager for Apache/Nginx/etc..
https://github.com/tetreum/vhostmanager
apache manager nginx php vhost
Last synced: 10 months ago
JSON representation
Virtual host manager for Apache/Nginx/etc..
- Host: GitHub
- URL: https://github.com/tetreum/vhostmanager
- Owner: tetreum
- Created: 2016-07-20T18:01:28.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-09-21T13:18:26.000Z (over 9 years ago)
- Last Synced: 2025-04-05T02:41:22.015Z (about 1 year ago)
- Topics: apache, manager, nginx, php, vhost
- Language: PHP
- Size: 14.6 KB
- Stars: 9
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# WIP [](https://travis-ci.org/tetreum/vhostmanager)
Create virtual hosts/vhosts for Nginx/Apache/etc.. via php.
# Get an existing domain
```php
use VHostManager\VHostManager;
$manager = new VHostManager(VHostManager::NGINX);
$domain = $manager->getDomain("default");
print_r($domain);
```
# Add a domain
```php
use VHostManager\VHostManager;
$manager = new VHostManager(VHostManager::NGINX);
$manager->addDomain([
"domain" => "mongo.dev",
"port" => 80,
"root" => "/var/www/mongo",
"locations" => [
"'^~ /var/'" => [
"deny" => "all"
]
]
]);
```
# Get conversion
```php
use VHostManager\VHostManager;
$manager = new VHostManager(VHostManager::APACHE);
$manager->getConversion([
"domain" => "mongo.dev",
"port" => 80,
"root" => "/var/www/mongo",
"locations" => [
"'^~ /var/'" => [
"deny" => "all"
]
]
]);
```
Result:
```
ServerName mongo.dev
DocumentRoot /var/www/mongo
ErrorLog /var/log/mongo/error.log
TransferLog /var/log/mongo/access.log
Deny all
```
It will attempt to restart nginx service.
# Universally supported options
```php
[
"domain" => "mongo.dev",
"port" => 80,
"root" => "/var/www/mongo",
"logs" => [
"error" => "/var/log/mongo/error.log",
"access" => "/var/log/mongo/access.log",
],
"locations" => [
"'^~ /var/'" => [
"deny" => "all"
]
]
]
```