NAME

Ado::Command::generate::apache2vhost - Generates minimal Apache2 Virtual Host configuration file

SYNOPSIS

On the command-line:

$ bin/ado generate apache2vhost --ServerName example.com \
 > etc/001-example.com.vhost.conf

Review your newly generated 001-example.com.vhost.conf!!! Create link to your generated configuration.

# ln -siv /home/you/dev/Ado/etc/001-example.com.vhost.conf \
/etc/apache2/sites-enabled/001-example.com.vhost.conf

# service apache2 reload

Generate your .htaccess file. Since you own the machine, you can put its content into the 001-example.com.vhost.conf file.

$ bin/ado generate apache2htaccess --module fcgi \
 > $MOJO_HOME/.htaccess

Programatically:

use Ado::Command::generate::apache2vhost;
my $vhost = Ado::Command::generate::apache2vhost->new;
$vhost->run('--ServerName' => 'example.com', '-p' => 8080);

DESCRIPTION

Ado::Command::generate::apache2vhost generates a minimal Apache2 Virtual Host configuration file for your Ado application.

This is a core command, that means it is always enabled and its code a good example for learning to build new commands, you're welcome to fork it.

OPTIONS

Below are the options this command accepts described in Getopt::Long notation.

n|ServerName=s

Fully Qualified Domain Name for the virtual host. Required! See also documentation for Apache2 directive ServerName.

p|port=i

Port on which this host will be served. Defaults to 80.

A|ServerAlias=s

Alias for ServerName. Defaults to 'www.'.$ServerName. See also documentation for Apache2 directive ServerAlias.

a|ServerAdmin=s

Email of the administrator for this host - you. Defaults to webmaster@$ServerName. See also documentation for Apache2 directive ServerAdmin.

D|DocumentRoot=s

DocumentRoot for the virtual host. Defaults to $ENV{MOJO_HOME}. See also documentation for Apache2 directive DocumentRoot.

c|config_file=s

Full path to the file in which the configuaration will be written. If not provided the configuaration is printed to the screen.

s|with_suexec

Adds SuexecUserGroup directive which is effective only if mod_suexec is loaded. The user and the group are guessed from the user running the command.

u|user=s

User to be used with suexec.

g|group=s

Group to be used with suexec.

v|verbose

Verbose output.

ATTRIBUTES

Ado::Command::generate::apache2vhostn inherits all attributes from Ado::Command::generate and implements the following new ones.

args

Used for storing arguments from the commandline and then passing them to the template

my $args = $self->args;

description

my $description = $vhost->description;
$v              = $vhost->description('Foo!');

Short description of this command, used for the command list.

usage

my $usage = $vhost->usage;
$v        = $vhost->usage('Foo!');

Usage information for this command, used for the help screen.

METHODS

Ado::Command::generate::apache2vhost inherits all methods from Ado::Command::generate and implements the following new ones.

run

$vhost->run(@ARGV);

Run this command.

SEE ALSO

Apache deployment, Apache - Upgrading to 2.4 from 2.2, Ado::Command::generate::apache2htaccess, Mojolicious::Command::generate, Getopt::Long, Ado::Command Ado::Manual, Mojolicious, "DEPLOYMENT" in Mojolicious::Guides::Cookbook