📄 apache2::perlsections.3
字号:
.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05).\".\" Standard preamble:.\" ========================================================================.de Sh \" Subsection heading.br.if t .Sp.ne 5.PP\fB\\$1\fR.PP...de Sp \" Vertical space (when we can't use .PP).if t .sp .5v.if n .sp...de Vb \" Begin verbatim text.ft CW.nf.ne \\$1...de Ve \" End verbatim text.ft R.fi...\" Set up some character translations and predefined strings. \*(-- will.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left.\" double quote, and \*(R" will give a right double quote. \*(C+ will.\" give a nicer C++. Capital omega is used to do unbreakable dashes and.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,.\" nothing in troff, for use with C<>..tr \(*W-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'.ie n \{\. ds -- \(*W-. ds PI pi. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch. ds L" "". ds R" "". ds C` "". ds C' ""'br\}.el\{\. ds -- \|\(em\|. ds PI \(*p. ds L" ``. ds R" '''br\}.\".\" Escape single quotes in literal strings from groff's Unicode transform..ie \n(.g .ds Aq \(aq.el .ds Aq '.\".\" If the F register is turned on, we'll generate index entries on stderr for.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index.\" entries marked with X<> in POD. Of course, you'll have to process the.\" output yourself in some meaningful fashion..ie \nF \{\. de IX. tm Index:\\$1\t\\n%\t"\\$2"... nr % 0. rr F.\}.el \{\. de IX...\}.\".\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2)..\" Fear. Run. Save yourself. No user-serviceable parts.. \" fudge factors for nroff and troff.if n \{\. ds #H 0. ds #V .8m. ds #F .3m. ds #[ \f1. ds #] \fP.\}.if t \{\. ds #H ((1u-(\\\\n(.fu%2u))*.13m). ds #V .6m. ds #F 0. ds #[ \&. ds #] \&.\}. \" simple accents for nroff and troff.if n \{\. ds ' \&. ds ` \&. ds ^ \&. ds , \&. ds ~ ~. ds /.\}.if t \{\. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u". ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'.\}. \" troff and (daisy-wheel) nroff accents.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'.ds 8 \h'\*(#H'\(*b\h'-\*(#H'.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#].ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#].ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#].ds ae a\h'-(\w'a'u*4/10)'e.ds Ae A\h'-(\w'A'u*4/10)'E. \" corrections for vroff.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'. \" for low resolution devices (crt and lpr).if \n(.H>23 .if \n(.V>19 \\{\. ds : e. ds 8 ss. ds o a. ds d- d\h'-1'\(ga. ds D- D\h'-1'\(hy. ds th \o'bp'. ds Th \o'LP'. ds ae ae. ds Ae AE.\}.rm #[ #] #H #V #F C.\" ========================================================================.\".IX Title "mod_perl-2.0.2::docs::api::Apache2::PerlSections 3".TH mod_perl-2.0.2::docs::api::Apache2::PerlSections 3 "2005-10-21" "perl v5.10.0" "User Contributed Perl Documentation".\" For nroff, turn off justification. Always turn off hyphenation; it makes.\" way too many mistakes in technical documents..if n .ad l.nh.SH "NAME"Apache2::PerlSections \- write Apache configuration files in Perl.SH "Synopsis".IX Header "Synopsis".Vb 2\& <Perl>\& @PerlModule = qw(Mail::Send Devel::Peek);\& \& #run the server as whoever starts it\& $User = getpwuid(>) || >;\& $Group = getgrgid()) || );\& \& $ServerAdmin = $User;\& \& </Perl>.Ve.SH "Description".IX Header "Description"With \f(CW\*(C`<Perl>\*(C'\fR...\f(CW\*(C`</Perl>\*(C'\fR sections, it is possibleto configure your server entirely in Perl..PP\&\f(CW\*(C`<Perl>\*(C'\fR sections can contain \fIany\fR and as much Perl code asyou wish. These sections are compiled into a special package whosesymbol table mod_perl can then walk and grind the names and values ofPerl variables/structures through the Apache core configuration gears..PPBlock sections such as \f(CW\*(C`<Location>\*(C'\fR..\f(CW\*(C`</Location>\*(C'\fRare represented in a \f(CW%Location\fR hash, e.g.:.PP.Vb 10\& <Perl>\& $Location{"/~dougm/"} = {\& AuthUserFile => \*(Aq/tmp/htpasswd\*(Aq,\& AuthType => \*(AqBasic\*(Aq,\& AuthName => \*(Aqtest\*(Aq,\& DirectoryIndex => [qw(index.html index.htm)],\& Limit => {\& "GET POST" => {\& require => \*(Aquser dougm\*(Aq,\& }\& },\& };\& </Perl>.Ve.PPIf an Apache directive can take two or three arguments you may pushstrings (the lowest number of arguments will be shifted off the\&\f(CW@list\fR) or use an array reference to handle any number greater thanthe minimum for that directive:.PP.Vb 1\& push @Redirect, "/foo", "http://www.foo.com/";\& \& push @Redirect, "/imdb", "http://www.imdb.com/";\& \& push @Redirect, [qw(temp "/here" "http://www.there.com")];.Ve.PPOther section counterparts include \f(CW%VirtualHost\fR, \f(CW%Directory\fR and\&\f(CW%Files\fR..PPTo pass all environment variables to the children with a singleconfiguration directive, rather than listing each one via \f(CW\*(C`PassEnv\*(C'\fRor \f(CW\*(C`PerlPassEnv\*(C'\fR, a \f(CW\*(C`<Perl>\*(C'\fR section could read in a file and:.PP.Vb 1\& push @PerlPassEnv, [$key => $val];.Ve.PPor.PP.Vb 1\& Apache2\->httpd_conf("PerlPassEnv $key $val");.Ve.PPThese are somewhat simple examples, but they should give you the basicidea. You can mix in any Perl code you desire. See \fIeg/httpd.conf.pl\fRand \fIeg/perl_sections.txt\fR in the mod_perl distribution for moreexamples..PPAssume that you have a cluster of machines with similar configurationsand only small distinctions between them: ideally you would want tomaintain a single configuration file, but because the configurationsaren't \fIexactly\fR the same (e.g. the \f(CW\*(C`ServerName\*(C'\fR directive) it's notquite that simple..PP\&\f(CW\*(C`<Perl>\*(C'\fR sections come to rescue. Now you have a singleconfiguration file and the full power of Perl to tweak the localconfiguration. For example to solve the problem of the \f(CW\*(C`ServerName\*(C'\fRdirective you might have this \f(CW\*(C`<Perl>\*(C'\fR section:.PP.Vb 3\& <Perl>\& $ServerName = \`hostname\`;\& </Perl>.Ve.PPFor example if you want to allow personal directories on all machinesexcept the ones whose names start with \fIsecure\fR:.PP.Vb 9\& <Perl>\& $ServerName = \`hostname\`;\& if ($ServerName !~ /^secure/) {\& $UserDir = "public.html";\& }\& else {\& $UserDir = "DISABLED";\& }\& </Perl>.Ve.ie n .SH "@PerlConfig\fP and \f(CW$PerlConfig".el .SH "\f(CW@PerlConfig\fP and \f(CW$PerlConfig\fP".IX Header "@PerlConfig and $PerlConfig"This array and scalar can be used to introduce literal configurationinto the apache configuration. For example:.PP.Vb 1\& push @PerlConfig, \*(AqAlias /foo /bar\*(Aq;.Ve.PPOr: \f(CW$PerlConfig\fR .= \*(L"Alias /foo /bar\en\*(R";.PPSee also\&\f(CW\*(C`$r\->add_config\*(C'\fR.SH "Configuration Variables".IX Header "Configuration Variables"There are a few variables that can be set to change the defaultbehaviour of \f(CW\*(C`<Perl>\*(C'\fR sections..ie n .Sh "$Apache2::PerlSections::Save".el .Sh "\f(CW$Apache2::PerlSections::Save\fP".IX Subsection "$Apache2::PerlSections::Save"Each \f(CW\*(C`<Perl>\*(C'\fR section is evaluated in its unique namespace,by default residing in a sub-namespace of \f(CW\*(C`Apache2::ReadConfig::\*(C'\fR,therefore any local variables will end up in that namespace. Forexample if a \f(CW\*(C`<Perl>\*(C'\fR section happened to be in file\&\fI/tmp/httpd.conf\fR starting on line 20, the namespace:\&\f(CW\*(C`Apache2::ReadConfig::tmp::httpd_conf::line_20\*(C'\fR will be used. Now ifit had:.PP.Vb 5\& <Perl>\& $foo = 5;\& my $bar = 6;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -