| 1 | # | ||
| 2 | # This file is part of WebDyne. | ||
| 3 | # | ||
| 4 | # This software is copyright (c) 2025 by Andrew Speer <andrew.speer@isolutions.com.au>. | ||
| 5 | # | ||
| 6 | # This is free software; you can redistribute it and/or modify it under | ||
| 7 | # the same terms as the Perl 5 programming language system itself. | ||
| 8 | # | ||
| 9 | # Full license text is available at: | ||
| 10 | # | ||
| 11 | # <http://dev.perl.org/licenses/> | ||
| 12 | # | ||
| 13 | |||
| 14 | #------------------------------------------------------------------------------ | ||
| 15 | # | ||
| 16 | # WebDyne Apache configuration section | ||
| 17 | # | ||
| 18 | #------------------------------------------------------------------------------ | ||
| 19 | # | ||
| 20 | # | ||
| 21 | |||
| 22 | |||
| 23 | # Need mod_perl, load up if not already done | ||
| 24 | # | ||
| 25 | <!-- | ||
| 26 | |||
| 27 | # | ||
| 28 | my @out; | ||
| 29 | if ($MP2_INSTALLED) { | ||
| 30 | @out=( | ||
| 31 | '<IfModule !mod_perl.c>', | ||
| 32 | "LoadModule perl_module \"$FILE_MOD_PERL_LIB\"", | ||
| 33 | '</IfModule>' | ||
| 34 | ); | ||
| 35 | } | ||
| 36 | else { | ||
| 37 | @out=( | ||
| 38 | '<IfModule !mod_perl.c>', | ||
| 39 | "LoadModule perl_module \"$FILE_MOD_PERL_LIB\"", | ||
| 40 | 'AddModule mod_perl.c', | ||
| 41 | '</IfModule>' | ||
| 42 | ); | ||
| 43 | } | ||
| 44 | $OUT=join($/, @out); | ||
| 45 | |||
| 46 | --> | ||
| 47 | |||
| 48 | <!-- | ||
| 49 | # Fix up @INC path, do any other init stuff before loading WebDyne | ||
| 50 | # module | ||
| 51 | # | ||
| 52 | ##use Config; | ||
| 53 | ## | ||
| 54 | ##my $installbin_dn=$DIR_INSTALLBIN || $Config{'installbin'}; | ||
| 55 | ##my $perl5lib_fn; | ||
| 56 | ## | ||
| 57 | ##unless ($perl5lib_fn=$INC{$FILE_PERL5LIB}) { | ||
| 58 | ## $perl5lib_fn=File::Spec->catfile($installbin_dn, $FILE_PERL5LIB); | ||
| 59 | ##} | ||
| 60 | ##else { | ||
| 61 | ## $perl5lib_fn=File::Spec->canonpath($perl5lib_fn); | ||
| 62 | ##} | ||
| 63 | ## | ||
| 64 | ##$OUT=qq[#PerlRequire "$perl5lib_fn"] | ||
| 65 | ## | ||
| 66 | --> | ||
| 67 | |||
| 68 | |||
| 69 | # Load Apache::compat module if running mod_perl 1.99 | ||
| 70 | # | ||
| 71 | <!-- | ||
| 72 | 4 | ▶ | use Config; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 73 | |||
| 74 | my $installbin_dn=$DIR_INSTALLBIN || $Config{'installbin'}; | ||
| 75 | |||
| 76 | my $mod_perl_1_99_compat_fn=File::Spec->catfile($installbin_dn, $FILE_MOD_PERL_1_99_COMPAT); | ||
| 77 | $OUT=qq[#PerlRequire "$mod_perl_1_99_compat_fn"] | ||
| 78 | |||
| 79 | --> | ||
| 80 | |||
| 81 | |||
| 82 | # Adjust and/or uncomment if using local::lib for installs | ||
| 83 | # | ||
| 84 | <!-- | ||
| 85 | if (my $perl5lib=$ENV{'PERL5LIB'}) { | ||
| 86 | $OUT=sprintf('PerlSwitches -I%s', $perl5lib); | ||
| 87 | } | ||
| 88 | else { | ||
| 89 | $OUT='#PerlSwitches -I/opt/perl5' | ||
| 90 | } | ||
| 91 | --> | ||
| 92 | # | ||
| 93 | |||
| 94 | # Load WebDyne modules | ||
| 95 | # | ||
| 96 | PerlModule WebDyne WebDyne::Compile | ||
| 97 | |||
| 98 | |||
| 99 | # Associate .psp files with WebDyne | ||
| 100 | # | ||
| 101 | <!-- | ||
| 102 | my @out; | ||
| 103 | if ($MP2_INSTALLED) { | ||
| 104 | @out=( | ||
| 105 | 'AddHandler modperl .psp', | ||
| 106 | 'PerlHandler WebDyne' | ||
| 107 | ); | ||
| 108 | } | ||
| 109 | else { | ||
| 110 | @out=( | ||
| 111 | '<LocationMatch "\.psp">', | ||
| 112 | 'SetHandler perl-script', | ||
| 113 | 'PerlHandler WebDyne', | ||
| 114 | '</LocationMatch>' | ||
| 115 | ); | ||
| 116 | } | ||
| 117 | $OUT=join($/, @out); | ||
| 118 | --> | ||
| 119 | |||
| 120 | |||
| 121 | # Block access to any module .pm files that might available in public | ||
| 122 | # areas as a precaution | ||
| 123 | # | ||
| 124 | |||
| 125 | <!-- | ||
| 126 | |||
| 127 | if ($HTTPD_VER eq '2.2') { | ||
| 128 | $OUT=<<__PM_DENY_22__; | ||
| 129 | |||
| 130 | # Apache 2.2 block config | ||
| 131 | # | ||
| 132 | <Files ~ "\.pm\$"> | ||
| 133 | Order allow,deny | ||
| 134 | Deny from all | ||
| 135 | </Files> | ||
| 136 | __PM_DENY_22__ | ||
| 137 | |||
| 138 | } | ||
| 139 | elsif ($HTTPD_VER eq '2.4') { | ||
| 140 | |||
| 141 | $OUT=<<__PM_DENY_24__; | ||
| 142 | |||
| 143 | # Apache 2.4 block config | ||
| 144 | # | ||
| 145 | <Files ~ "\.pm\$"> | ||
| 146 | Require all denied | ||
| 147 | </Files> | ||
| 148 | |||
| 149 | __PM_DENY_24__ | ||
| 150 | |||
| 151 | } | ||
| 152 | |||
| 153 | --> | ||
| 154 | |||
| 155 | # Set disk cache dir and allow apache access | ||
| 156 | # | ||
| 157 | PerlSetVar WEBDYNE_CACHE_DN "<!-- $WEBDYNE_CACHE_DN -->" | ||
| 158 | |||
| 159 | <!-- | ||
| 160 | |||
| 161 | if ($HTTPD_VER eq '2.2') { | ||
| 162 | $OUT=<<"__CACHE_ALLOW_22__"; | ||
| 163 | |||
| 164 | # Apache 2.2 cache allow config | ||
| 165 | # | ||
| 166 | <Directory "$WEBDYNE_CACHE_DN"> | ||
| 167 | Order allow,deny | ||
| 168 | Allow from all | ||
| 169 | Deny from none | ||
| 170 | </Directory> | ||
| 171 | |||
| 172 | __CACHE_ALLOW_22__ | ||
| 173 | } | ||
| 174 | elsif ($HTTPD_VER eq '2.4') { | ||
| 175 | $OUT=<<"__CACHE_ALLOW_24__"; | ||
| 176 | |||
| 177 | # Apache 2.4 cache allow config | ||
| 178 | # | ||
| 179 | <Directory "$WEBDYNE_CACHE_DN"> | ||
| 180 | Require all granted | ||
| 181 | </Directory> | ||
| 182 | __CACHE_ALLOW_24__ | ||
| 183 | } | ||
| 184 | |||
| 185 | --> | ||
| 186 | |||
| 187 | |||
| 188 | # Some config setting defaults. See documentation for full range. Commented out | ||
| 189 | # options represent defaults | ||
| 190 | # | ||
| 191 | PerlRequire "<!-- File::Spec->catfile($DIR_APACHE_CONF, 'webdyne_conf.pl') -->" | ||
| 192 | |||
| 193 | |||
| 194 | # Optional debugging. Everything or some things. Note debugging only enabled if | ||
| 195 | # WebDybe installed with WEBDYNE_DEBUG=1; perl Makefile.PL; make install | ||
| 196 | # | ||
| 197 | #PerlSetEnv WEBDYNE_DEBUG 1 | ||
| 198 | #PerlSetEnv WEBDYNE_DEBUG "render,perl" | ||
| 199 | #PerlSetEnv WEBDYNE_DEBUG_FILE "/var/log/webdyne_debug.log" | ||
| 200 | |||
| 201 | |||