SID-02336: Fresh install of TWiki-6.0.2 problem with CSS, images
Status: |
Asked |
TWiki version: |
6.0.2 |
Perl version: |
5.016003 |
Category: |
CategoryInstallation |
Server OS: |
CentOS Linux release 7.3.1611 (Core) |
Last update: |
6 years ago |
Just TWiki-6.0.2, build 29687 by stumbling through the install guide, it was not easy. I don't think I'm smart enough.
The result is a TWiki that looks like it can't find its own CSS and images. It's all plain HTML-looking, with text in place of the buttons along the top. In fact, there is no graphics on the
WebHome page at all.
--
TWiki Guest - 2017-10-13
Discussion and Answer
Should have said "Just installed TWiki-6.0.2, build 29687..."
--
TWiki Guest - 2017-10-13
See related question
images not loading
--
Peter Thoeny - 2017-10-13
This symptom usually points to non-matching configurations between TWiki and the web server: Though the CSS files and images are TWiki's own, the web server is supposed to present them to the user without intervention TWiki software. Good news is that this usually easily fixed.
The best starting point to create the web server configuration is
ApacheConfigGenerator (also recommended in the
TWikiInstallationGuide).
- If you've done so, then one pitfall is the file and directory permissions: CSS files and images reside in the
pub
directory (relative to TWiki's installation root), and the files and directories therein must be readable by the user id running Apache (in CentOS that would be apache
). Don't just chmod -R 644 pub
because the directories need to have their x
bit set!
- Another thing to check is the TWiki configuration: Check the settings for
PubDir
and PubUrlPath
. PubDir
should be the absolute path to the pub
directory, whereas PubUrlPath
is the path to the "URL space" of that directory. If your TWiki URL (config setting ScriptUrlPath
) is somewhere/bin
, then PubUrlPath
should be somewhere/pub
.
For "static" files like CSS and images, the web server's error log (at
/var/log/apache2/error.log
) should provide information
where the web server has been looking for the files, and
what went wrong.
--
Harald Jörg - 2017-10-13
Harald: Thanks for the information. Here's what I've discovered.
By using all defaults at installation:
Everything is installed under /var/www/twiki
All files and directories under /var/www/TWiki/pub are owned by apache:apache (including pub itself)
All files under /var/www/TWiki/pub are rw-rw-r-- (readable by everyone)
All directories under (and including) /var/www/TWiki/pub are rwxr-xr-x.
I haven't tried to generate a new web server config file using the
ApacheConfigGenerator because I already had a config file that i thought was right (obviously, it isn't.)
I do not have a directory /var/log/apache2
xx.xx.134.102 is my workstation, xx.xx.132.187 is the
CentOS box I'm trying to bring TWiki up on.
In /var/log/httpd/ I have a a file errorlog in which I see a lot of warnings, but filtering them out, I get one instance of
[Fri Oct 13 12:05:21.232864 2017] [cgi:error] [pid 15621] [client xx.xx.134.102:17522] attempt to invoke directory as script: /var/www/twiki/bin/, referer:
http://xx.xx.132.187/do/configure
but this one happens a lot:
[Fri Oct 13 11:47:56.826583 2017] [cgi:error] [pid 420] [client xx.xx.134.102:16938] script not found or unable to stat: /var/www/twiki/bin/TWiki, referer:
http://xx.xx.132.187/do/view/
--
TWiki Guest - 2017-10-13
Information I gleaned from
http://myserver/do/configure
My {ScriptUrlPath} is simply
/do
{PubUrlPath} is
/twiki/pub
{PubDir} is
/var/www/twiki/pub
{TemplateDir} is
/var/www/twiki/templates
{DataDir} is
/var/www/twiki/data
{LocalesDir} is
/var/www/twiki/locale
--
TWiki Guest - 2017-10-13
This is what my twiki.conf file looks like:
<verbatim>
BrowserMatchNoCase ^$ blockAccess
<IfModule mod_perl.c>
# Mod_perl preloading
PerlSwitches -T
</IfModule>
ScriptAlias /do "/var/www/twiki/bin"
Alias /pub "/var/www/twiki/pub"
<Directory "/var/www/twiki/bin">
AllowOverride None
Order Allow,Deny
Allow from all
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>
<Directory "/var/www/twiki/pub">
Options None
AllowOverride None
Order Allow,Deny
Allow from all
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
</Directory>
</verbatim>
--
TWiki Guest - 2017-10-13
<pre>
BrowserMatchNoCase ^$ blockAccess
<IfModule mod_perl.c>
# Mod_perl preloading
PerlSwitches -T
</IfModule>
ScriptAlias /do "/var/www/twiki/bin"
Alias /pub "/var/www/twiki/pub"
<Directory "/var/www/twiki/bin">
AllowOverride None
Order Allow,Deny
Allow from all
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>
<Directory "/var/www/twiki/pub">
Options None
AllowOverride None
Order Allow,Deny
Allow from all
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
</Directory>
</pre>
--
TWiki Guest - 2017-10-13
I guess I don't know how to post code.
--
TWiki Guest - 2017-10-13
Sorry for the wrong name for the error log! I'm not familiar with CentOS and typed the Debian path without thinking.
And don't worry about how to post code: Unfortunately, this is impossible using the "Add comment" form here. You can either just "edit" the page and then paste the stuff in
<verbatim>
blocks, or simply attach files instead of copypasting the contents. Anyway, it's good enough to spot some quirks:
- I guess that mixing up
twiki
and TWiki
in your file paths when reporting permissions did just happen while typing, and actually all your directories are lowercase. On Linux you can have both /var/www/TWiki/pub
and /var/www/twiki/pub
in your file system, which could cause a lot of confusion.
- I guess the problem lies here:
- In the web server config you have:
Alias /pub "/var/www/twiki/pub"
- In configure, you have: {PubUrlPath} is
/twiki/pub
. That should be: {PubUrlPath} is /pub
! The left hand side of the Alias
directive is the same "URL space" which TWiki needs to use as PubUrlPath
.
--
Harald Jörg - 2017-10-13
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.