104 lines
2.6 KiB
Plaintext
104 lines
2.6 KiB
Plaintext
{
|
|
|
|
if (($dokuwiki{'status'} || 'disabled') eq 'enabled'){
|
|
my $alias = (($dokuwiki{'AliasOnPrimary'} || 'enabled') eq 'enabled' ) ? 'Alias /dokuwiki /usr/share/dokuwiki':'';
|
|
my $allow = (($dokuwiki{'access'} || 'private') eq 'public') ? 'all':"$localAccess $externalSSLAccess";
|
|
my $auth = (($dokuwiki{'Authentication'} || 'internal') eq 'http') ? "AuthName \"Dokuwiki\"\n" .
|
|
" AuthType Basic\n" .
|
|
" AuthExternal pwauth\n" .
|
|
" Require valid-user\n" : '';
|
|
my $ssl = (($dokuwiki{'RequireSSL'} || 'enabled') =~ m/^(enabled|yes|on)$/i) ?
|
|
'SSLRequireSSL on':'# SSL is not encforced';
|
|
my $maxsize = $dokuwiki{'MaxUploadSize'} || '200';
|
|
$maxsize .= 'M' unless ($maxsize =~ m/M$/);
|
|
my $php =<<_EOF;
|
|
|
|
AddType application/x-httpd-php .php
|
|
php_admin_value open_basedir /usr/share/dokuwiki:/var/lib/dokuwiki:/etc/dokuwiki:/dev/urandom
|
|
php_admin_value memory_limit 128M
|
|
php_admin_value upload_max_filesize $maxsize
|
|
php_admin_value post_max_size $maxsize
|
|
php_admin_value upload_tmp_dir /var/lib/dokuwiki/data/tmp
|
|
php_admin_value session.save_path /var/lib/dokuwiki/data/tmp
|
|
|
|
_EOF
|
|
if ($fastcgi_mod eq 'mod_fastcgi'){
|
|
$php = "AddHandler phpdokuwiki-fastcgi .php\n";
|
|
}
|
|
elsif ($fastcgi_mod eq 'mod_proxy_fcgi'){
|
|
$php =<<_EOF;
|
|
|
|
<FilesMatch \.php$>
|
|
SetHandler "proxy:unix:/var/run/php-fpm/php__PHP_VERSION__-dokuwiki.sock|fcgi://localhost"
|
|
</FilesMatch>
|
|
_EOF
|
|
}
|
|
|
|
$OUT .=<<"EOF";
|
|
|
|
$alias
|
|
|
|
<Directory /usr/share/dokuwiki>
|
|
AllowOverride None
|
|
Options +FollowSymlinks
|
|
Order Allow,Deny
|
|
Allow from $allow
|
|
$ssl
|
|
$auth
|
|
$php
|
|
</Directory>
|
|
|
|
<Directory /usr/share/dokuwiki/inc>
|
|
Order Deny,Allow
|
|
Deny from all
|
|
</Directory>
|
|
|
|
<Directory /usr/share/dokuwiki/inc/lang>
|
|
Order Deny,Allow
|
|
Deny from all
|
|
</Directory>
|
|
|
|
<Directory /usr/share/dokuwiki/lib/_fla>
|
|
## no access to the fla directory
|
|
Order allow,deny
|
|
Deny from all
|
|
</Directory>
|
|
|
|
## no access to the conf directory
|
|
<Directory /etc/dokuwiki>
|
|
Order allow,deny
|
|
Deny from all
|
|
</Directory>
|
|
<Directory /usr/share/dokuwiki/conf>
|
|
Order allow,deny
|
|
Deny from all
|
|
</Directory>
|
|
|
|
## no access to the data directory
|
|
<Directory /usr/share/dokuwiki/data>
|
|
Order allow,deny
|
|
Deny from all
|
|
</Directory>
|
|
<Directory /var/lib/dokuwiki>
|
|
Order allow,deny
|
|
Deny from all
|
|
</Directory>
|
|
|
|
|
|
EOF
|
|
|
|
}
|
|
else {
|
|
$OUT .=<<'EOF';
|
|
|
|
# Dokuwiki is disabled
|
|
# You can enable it with
|
|
# db configuration setprop dokuwiki status enabled
|
|
# signal-event webapps-update
|
|
|
|
EOF
|
|
}
|
|
|
|
}
|
|
|