SID-02219: Check the configuration for TemplateDir and TemplatePath?
| Status: |
Answered |
TWiki version: |
6.0.2 |
Perl version: |
perl 5, version 20 |
| Category: |
|
Server OS: |
Debian GNU/Linux 8.2 (jessie) |
Last update: |
10 years ago |
Hi, I am getting the following error below. I have set the correct path or both the
TemplateDir and
TemplatePath in the web UI and in the
LocalSite.cfg
This is exactly what i have
#
*PATH M*
# Template directory e.g. /usr/local/twiki/templates
$TWiki::cfg{TemplateDir} = '/var/www/twiki/templates';
Below i have put the exact path instead of {TemplateDir} as directed by
http://twiki.org/cgi-bin/view/Support/Perl5ErrorsTemplateProblem
but still no luck I have restarted apache and no difference.
#
*STRING 120 EXPERT*
# Template path. A comma-separated list of generic file names, containing
# variables standing for part of the file name. When a template $name in $web
# with $skin is requested, this path is instantiated into a sequence of file
# names. The first file on this list that is found considered to be the
# requested template file. The file names can either be absolute file names
# ending in ".tmpl" or a topic file in a TWiki web.
$TWiki::cfg{TemplatePath} = '$TWiki::cfg{/var/www/twiki/templates}/$web/$name.$skin.tmpl, $TWiki::cfg{/var/www/twiki/templates}/$name.$skin.tmpl, $TWiki::cfg{/var/www/twiki/templates}/$web/$name.tmpl, $TWiki::cfg{/var/www/twiki/templates}/$name.tmpl, $web.$skinSkin$nameTemplate, $TWiki::cfg{SystemWebName}.$skinSkin$nameTemplate, $web.$nameTemplate, $TWiki::cfg{SystemWebName}.$nameTemplate';
TWiki Installation Error
Template "oopsnotfound" not found.
Check the configuration settings for {TemplateDir} and {TemplatePath}.
--
Adam Khan - 2016-06-28
Discussion and Answer
Hi Adam,
I have limited knowledge but I believe that
LocalSite.cfg is created by
configure so you shouldn't need to edit it to change {TemplateDir} and {TemplatePath}.
I've read the link you posted and there's some caution about being careful making the replacements to {TemplatePath} so I've just pasted the full details below from my installation. Perhaps copying and pasting into configure would rule out any errors?
{TemplateDir}: /var/www/twiki/templates
{TemplatePath}: /var/www/twiki/templates/$web/$name.$skin.tmpl, /var/www/twiki/templates/$name.$skin.tmpl, /var/www/twiki/templates/$web/$name.tmpl, /var/www/twiki/templates/$name.tmpl, $web.$skinSkin$nameTemplate, TWiki.$skinSkin$nameTemplate, $web.$nameTemplate, TWiki.$nameTemplate
I don't believe your {TemplatePath} should contain
$TWiki::cfg{/var/www/twiki/templates} as you've pasted above.
--
Jani Hamalainen - 2016-06-28
Thanks Jain, I got it working i delete the
LocalSite.cfg and reran the configuration its up now.
Missing images but its up...I cant believe how hard this is to install. I installed Dokuwiki in 10min and had it up and running.
--
Adam Khan - 2016-06-29
On missing images, it means that there is a mismatch with apache's twiki.conf's Alias setting and TWiki's
{PubUrlPath} and
{PubDir} configure settings.
For example, if you have this apache configuration:
Alias /pub "/var/www/twiki/pub"
You need these TWiki configure settings:
{PubUrlPath} = '/pub'
{PubDir} = '/var/www/twiki/pub'
Best to use the
ApacheConfigGenerator.
--
Peter Thoeny - 2016-06-29
Peter below is my config file.
# Autogenerated httpd.conf file for TWiki.
# Generated at http://twiki.org/cgi-bin/view/TWiki/ApacheConfigGenerator
# IMPORTANT NOTE: Make sure to enable mod_cgi in the primary apache configuration file.
# We set an environment variable called blockAccess.
#
# Setting a BrowserMatchNoCase to ^$ is important. It prevents TWiki from
# including its own topics as URLs and also prevents other TWikis from
# doing the same. This is important to prevent the most obvious
# Denial of Service attacks.
#
# You can expand this by adding more BrowserMatchNoCase statements to
# block evil browser agents trying the impossible task of mirroring a twiki
#
# Example:
# BrowserMatchNoCase ^SiteSucker blockAccess
# BrowserMatchNoCase ^$ blockAccess
BrowserMatchNoCase ^Accoona blockAccess
BrowserMatchNoCase ^ActiveAgent blockAccess
BrowserMatchNoCase ^Attache blockAccess
BrowserMatchNoCase BecomeBot blockAccess
BrowserMatchNoCase ^bot blockAccess
BrowserMatchNoCase Charlotte/ blockAccess
BrowserMatchNoCase ^ConveraCrawler blockAccess
BrowserMatchNoCase ^CrownPeak-HttpAgent blockAccess
BrowserMatchNoCase ^EmailCollector blockAccess
BrowserMatchNoCase ^EmailSiphon blockAccess
BrowserMatchNoCase ^e-SocietyRobot blockAccess
BrowserMatchNoCase ^Exabot blockAccess
BrowserMatchNoCase ^FAST blockAccess
BrowserMatchNoCase ^FDM blockAccess
BrowserMatchNoCase ^GetRight/6.0a blockAccess
BrowserMatchNoCase ^GetWebPics blockAccess
BrowserMatchNoCase ^Gigabot blockAccess
BrowserMatchNoCase ^gonzo1 blockAccess
BrowserMatchNoCase ^Google\sSpider blockAccess
BrowserMatchNoCase ^ichiro blockAccess
BrowserMatchNoCase ^ie_crawler blockAccess
BrowserMatchNoCase ^iGetter blockAccess
BrowserMatchNoCase ^IRLbot blockAccess
BrowserMatchNoCase Jakarta blockAccess
BrowserMatchNoCase ^Java blockAccess
BrowserMatchNoCase ^KrakSpider blockAccess
BrowserMatchNoCase ^larbin blockAccess
BrowserMatchNoCase ^LeechGet blockAccess
BrowserMatchNoCase ^LinkWalker blockAccess
BrowserMatchNoCase ^Lsearch blockAccess
BrowserMatchNoCase ^Microsoft blockAccess
BrowserMatchNoCase ^MJ12bot blockAccess
BrowserMatchNoCase MSIECrawler blockAccess
BrowserMatchNoCase ^MSRBOT blockAccess
BrowserMatchNoCase ^noxtrumbot blockAccess
BrowserMatchNoCase ^NutchCVS blockAccess
BrowserMatchNoCase ^RealDownload blockAccess
BrowserMatchNoCase ^Rome blockAccess
BrowserMatchNoCase ^Roverbot blockAccess
BrowserMatchNoCase ^schibstedsokbot blockAccess
BrowserMatchNoCase ^Seekbot blockAccess
BrowserMatchNoCase ^SiteSnagger blockAccess
BrowserMatchNoCase ^SiteSucker blockAccess
BrowserMatchNoCase ^Snapbot blockAccess
BrowserMatchNoCase ^sogou blockAccess
BrowserMatchNoCase ^SpiderKU blockAccess
BrowserMatchNoCase ^SpiderMan blockAccess
BrowserMatchNoCase ^Squid blockAccess
BrowserMatchNoCase ^Teleport blockAccess
BrowserMatchNoCase ^User-Agent\: blockAccess
BrowserMatchNoCase VoilaBot blockAccess
BrowserMatchNoCase ^voyager blockAccess
BrowserMatchNoCase ^W3C blockAccess
BrowserMatchNoCase ^w3search blockAccess
BrowserMatchNoCase ^Web\sDownloader blockAccess
BrowserMatchNoCase ^WebCopier blockAccess
BrowserMatchNoCase ^WebDevil blockAccess
BrowserMatchNoCase ^WebSec blockAccess
BrowserMatchNoCase ^WebVac blockAccess
BrowserMatchNoCase ^Webwhacker blockAccess
BrowserMatchNoCase ^Webzip blockAccess
BrowserMatchNoCase ^Wells blockAccess
BrowserMatchNoCase ^WhoWhere blockAccess
BrowserMatchNoCase www\.netforex\.org blockAccess
BrowserMatchNoCase ^WX_mail blockAccess
BrowserMatchNoCase ^yacybot blockAccess
BrowserMatchNoCase ^ZIBB blockAccess
BrowserMatchNoCase ^$ blockAccess
<IfModule mod_perl.c>
# Mod_perl preloading
PerlSwitches -T
</IfModule>
# The ScriptAlias defines the bin directory as a directory where CGI
# scripts are allowed.
# The first parameter will be part of the URL to your installation e.g.
# http://example.com/do/view/...
# The second parameter must point to the physical path on your disc.
ScriptAlias /do "/var/www/twiki/bin"
# The Alias defines a url that points to the twiki pub directory, which
# is the root of file attachments.
# Secure file attachments by using ScriptAlias with viewfile script.
Alias /var/www/twiki/pub/TWiki "/var/www/twiki/pub/TWiki"
Alias /var/www/twiki/pub/Sandbox "/var/www/twiki/pub/Sandbox"
ScriptAlias /var/www/twiki/pub "/var/www/twiki/bin/viewfile"
# Block access to typical spam related attachments
# Except the TWiki directory which is read only and does have attached html files.
SetEnvIf Request_URI "/var/www/twiki/pub/.*\.[hH][tT][mM][lL]?$" blockAccess
SetEnvIf Request_URI "/var/www/twiki/pub/TWiki/.*\.[hH][tT][mM][lL]?$" !blockAccess
# This specifies the options on the TWiki scripts directory. The ExecCGI
# and SetHandler tell apache that it contains scripts. "Require all granted"
# lets any IP address access this URL.
<Directory "/var/www/twiki/bin">
AllowOverride None
Require all granted
Deny from env=blockAccess
Options ExecCGI FollowSymLinks
SetHandler cgi-script
# Password file for TWiki users
AuthUserFile /var/www/twiki/data/.htpasswd
AuthName 'Enter your WikiName: (First name and last name, no space, no dots, capitalized, e.g. JohnSmith)'
AuthType Basic
# File to return on access control error (e.g. wrong password)
ErrorDocument 401 /do/view/TWiki/TWikiRegistration
</Directory>
# This sets the options on the pub directory, which contains attachments and
# other files like CSS stylesheets and icons. AllowOverride None stops a
# user installing a .htaccess file that overrides these options.
# Note that files in pub are *not* protected by TWiki Access Controls,
# so if you want to control access to files attached to topics you need to
# block access to the specific directories same way as the ApacheConfigGenerator
# blocks access to the pub directory of the Trash web
<Directory "/var/www/twiki/pub">
Options None
AllowOverride None
Require all granted
Deny from env=blockAccess
# Disable execusion of PHP scripts
php_admin_flag engine off
# This line will redefine the mime type for the most common types of scripts
AddType text/plain .shtml .php .php3 .phtml .phtm .pl .py .cgi
#add an Expires header that is sufficiently in the future that the browser does not even ask if its uptodate
# reducing the load on the server significantly
#IF you can, you should enable this - it _will_ improve your twiki experience, even if you set it to under one day.
# you may need to enable expires_module in your main apache config
#LoadModule expires_module libexec/httpd/mod_expires.so
#AddModule mod_expires.c
#<ifmodule mod_expires.c>
# <filesmatch "\.(jpg|gif|png|css|js)$">
# ExpiresActive on
# ExpiresDefault "access plus 11 days"
# </filesmatch>
#</ifmodule>
</Directory>
# Spammers are known to attach their stuff and then move it to trash where it remains unnoticed.
# We prevent viewing any attachments directly from pub
<Directory "/var/www/twiki/pub/Trash">
deny from all
</Directory>
--
Adam Khan - 2016-06-29
If images are missing, it is always worth a try to check apache's error log, which should say where (i.e. on which file path) it tried to find the files. The critical part is to understand where the configuration of both Apache and TWiki expect
file system paths, and where they expect
URL paths.
In your Apache configuration, you seem to have provided
file sytem paths in the field
URL path of the TWiki pub directory containing file attachments (mandatory):
In that line, you need to tell Apache the value of your
{PubUrlPath} in TWiki's configuration.
Indeed, TWiki's configuration has become too "powerful", or nerdy over time. Maybe it would be helpful to
exactly quote the names of the corresponding TWiki config variables in the
ApacheConfigGenerator next to the fields?
By the way: If you want to provide config files, it is usually better to attach them to the support topic than to copypaste them.
--
Harald Jörg - 2016-06-29
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.