简单的cli工具,用于在apache中轻松创建和删除虚拟主机。
a2svm的Python项目详细描述
a2svm是一个简单的cli工具,用于在apache中轻松创建和删除虚拟主机。
用法:A2SVM[-h][-v]{mk,ls,rm,en,ds}…
A2SVM命令是:
- mk创建虚拟主机
- ls在apache服务器上显示托管虚拟主机
- rm删除虚拟主机
- en启用虚拟主机
- ds禁用虚拟主机
有关特定命令的详细信息,请参阅“a2svm<;command>;-h”。
pypi包http://pypi.python.org/pypi/a2svm
来源https://github.com/cypx/a2svm
要求
A2SVM需要apache mod_宏,该宏可以通过以下命令安装在Debian 6上
$ aptitude install libapache2-mod-macro
一旦mod_宏可用,就可以创建一些模板供a2svm使用,如下面这样
<Macrovhost_standard$name$servername$directory><VirtualHost*:80> ServerName $servername DocumentRoot /var/www/$directory/public <Directory/var/www/$directory> Options FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error-$name.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/access-$name.log combined </VirtualHost></Macro> #Comments beginning by "a2svm_make_command" are used to run external commands #when vhost is created #a2svm_make_command: /bin/mkdir -p /var/www/$directory/public /var/www/$directory/log #a2svm_make_command: /bin/chown -R cyp:www-data /var/www/$directory #Comments beginning by "a2svm_remove_command" are used to run external commands #when vhost is removed #a2svm_remove_command: /bin/tar czf /var/www/archive/$servername.tgz /var/www/$directory #a2svm_remove_command: /bin/rm -rf /var/www/$directory
安装
轻松安装:
使用pip
$ pip install a2svm
使用简易安装
在大多数Linux发行版上
$ easy_install a2svm
但在某些情况下,先决条件是必需的,例如,在Debian6上
$ aptitude install python-pip
升级
使用pip
$ pip --upgrade a2svm
使用简易安装
$ easy_install --upgrade a2svm
来源
$ git clone https://github.com/cypx/a2svm
$ cd a2svm
$ python setup.py install
提醒
在pypi上发布包
$ pip install twine $ rm -rf dist $ python setup.py sdist bdist_wheel $ twine upload dist/*