Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  VHOSTCNAME (1)

.ds Aq ’


vhostcname - synchronize DNS with Apache virtual host configuration



<B>vhostcnameB> [OPTIONS] <B>COMMANDB>


The program takes a list of DNS zones and scans Apache virtual host configuration files. For each hostname found in <B>ServerNameB> and <B>ServerAliasB> statements, it checks whether this name ends in a zone from the list, and if so, attempts to register this hostname using the DNS dynamic updates mechanism (<B>RFC 2136B>).

A reverse operation is also supported: deregister all host name registered on the previous run.

The mode of operation is requested by the <B>COMMANDB> argument. The available <B>COMMANDB>s have been chosen so as to allow <B>vhostcnameB> to be run as one of the machine’s startup scripts. The exact ways to register it to be run on server startup and shutdown depend on the operating system and distribution in use. For example, on Debian-based GNU/Linux:

    cd /etc/init.d
    ln -sf /usr/bin/vhostcname /etc/init.d
    update-rc.d vhostcname defaults

The program can also be ised as a <B>dircondB>(8) handler. This use allows for immediate updates of the DNS records upon any modifications to the Apache configuration files. The following example shows the corresponding <B>dircond.confB>(5) entry:

    watcher {
        path /etc/apache2/sites-available;
        path /etc/apache2/sites-enabled;
        event (create,delete,write);
        timeout 10;
        option (stderr,stdout);
        command /usr/bin/vhostcname;


<B>startB> Scan the apache configuration files and register all server names matching the supplied zones.
<B>stopB> Deregister all hostnames registered previously.
<B>restartB>, <B>force-restartB>, <B>reloadB> Same as running <B>vhostcname stop; vhostcname startB>.
<B>statusB> Ignored


<B>--apache-config-directory=B>DIR Sets the Apache configuration directory. DIR should be either a directory where virtual configuration file are located or a directory which hosts the <B>sites-availableB> and <B>sites-enabledB> directories. In the latter case, <B>vhostcnameB> will look for files matching <B>apache-config-patternB> in DIR<B>/sites-enabledB>.

If this option is not given, <B>vhostcnameB> will try to deduce where the configuration files are located. It will issue a warning message and terminate if unable to do that.

<B>--apache-config-pattern=B>GLOB Shell globbing pattern for virtual host configuration files. By default, <B>*B> is used, meaning that <B>vhostcnameB> will scan all files in the configuration directory.
<B>--cname-file=B>NAME Name of the file where <B>vhostcnameB> will keep successfully registered host names. Default is <B>/var/run/vhostcname.cacheB>.
<B>-dB>, <B>--debugB> Increases the debug level. Multiple <B>-dB> options are allowed.
<B>-nB>, <B>--dry-runB>, Enables dry-run mode: print what would have been done without actually doing it.
<B>--helpB> Displays <B>vhostcnameB> man page.
<B>-hB> Displays a short help summary and exits.
<B>-HB>, <B>--hostnameB>=NAME Sets the hostname. Use this if <B>vhostcnameB> is unable to correctly determine it.
<B>--ns-key=B>KEYFILE Name of the key file. The argument should be the name of a file generated by the <B>dnssec-keygenB> utility. Either <B>.keyB> or <B>.privateB> file can be used.
<B>--server=B>NAME Name of the DNS server to use. Normally <B>vhostcnameB> determines what server to use based on the <B>SOAB> record of the zone to be updated, so this option is rarely needed.
<B>--ttl=B>TIME TTL value for new DNS records. Default is 3600.
<B>--zone=B>NAME Name of the zone which <B>vhostcnameB> can update. Multiple <B>--zoneB> options can be given.

If no <B>--zoneB> option is given, <B>vhostcnameB> will take hostname as the name of the zone.


If the file <B>etc/vhostcname.confB> exists, the program will read its configuration from it. A familiar UNIX configuration format is used. Empty lines and UNIX comments are ignored. Each non-empty line is either an option name, or option assignment, i.e. <B>optB>=<B>valB>, with any amount of optional whitespace around the equals sign. Valid option names are the same as the long command line options, but without the leading <B>--B>. For example:

  zone   =
  ns-key = /etc/bind/Kvhost+157+43558.key
  ttl    = 3600


<B>VHOSTCNAME_CONFB> The name of the configuration file to use instead of the default /etc/vhostcname.conf.


0 Success
1 Operating system error (unable to open file, etc.)
2 Some of the host names could not be registered.
3 Command line usage error


Only one key file can be given. This means that if you use multiple <B>--zoneB> options, all zones must be configured to accept the same DNSSEC key. Ditto for the <B>--serverB> option.




Sergey Poznyakoff <>


Hey! <B>The above document had some coding errors, which are explained below:B>
Around line 516: Expected text after =item, not a number
Around line 520: Expected text after =item, not a number
Around line 524: Expected text after =item, not a number
Search for    or go to Top of page |  Section 1 |  Main Index

perl v5.20.3 VHOSTCNAME (1) 2014-04-07

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.