Tags:
create new tag
, view all tags

Question

I am installing TWiki on a SunOS web server at Wesleyan University (Middletown, CT), where I have just taken a position as a Visiting Associate Professor of Computer Science. This is my first experience with TWiki, but I am very experienced with Wiki, Wiki installation, and Wiki modification using other implementations. I have encountered a configuration problem that I believe cannot be solved within the current parameterization structure, as follows. (This problem is related to WhereIsPubUrlDefined in that it presents the same initial symptom, with $PUBURL$ garbled the same way for the TWiki logo and other TWiki graphics, but does not appear to be solvable.)

Students, faculty, and staff accounts at Wesleyan are created with a ~/public_html directory, where ordinary web pages can go. That directory has a /cgi-bin subdirectory where cgi executables can go. Normal users have no access to the server's configuration or cgi-bin directories. Because cgi-bin's are automatically executed within a special wrapper that limits the damage they can do, they must be accessed through a special form of URL:

    http://condor.wesleyan.edu/cgi/USERNAME/SCRIPTNAME
(This executes /home/USERNAME/public_html/cgi-bin/SCRIPTNAME within the wrapper; condor is the machine running the web server.) For reasons I don't yet know, a user's regular web pages (in /home/USERNAME/public_html) are also accessed through a special, but different, URL:

    http://USERNAME.web.wesleyan.edu/
(the equivalent of /home/USERNAME/public_html). Note in particular the divergence of the URLs before the wesleyan.edu.

I have created a twiki directory in my cgi-bin directory, and moved bin, lib, and pub from the August 3 beta into it. (I'm using the beta because RCS is not installed on this server and because I don't want to deal with RCS if I can help it.) After some fiddling, I managed to get testenv working correctly. When I execute testenv, it shows HTTP_HOST as condor.wesleyan.edu and the REQUEST_URI, SCRIPT_NAME, and SCRIPT_URL as /cgi/USERNAME/twiki/bin/testenv. I have managed after many permutations to set variables in TWiki.cfg so that I don't get a complaint that my $defaultUrlHost doesn't match HTTP_HOST and the $pubUrlPath GIF is displayed. The relevant settings are:

    $defaultUrlHost   = "http://condor.wesleyan.edu";
    $scriptUrlPath    = "/cgi/mlmodel/twiki/bin";
    $pubUrlPath       = "http://mlmodel.web.wesleyan.edu/cgi-bin/twiki/pub";

The full $pubUrlPath is necessary to get the TWiki robot to show up on the testenv page, and it is the path I would specify to get to the pub directory via a non-cgi URL. However, this messes up $PUBURL$ and the URLs generated for the TWiki logo and other TWiki graphics on actual TWiki pages (not testenv). The TWiki logo URL, for example, comes out as:

    http://condor.wesleyan.eduhttp://mlmodel.web.wesleyan.edu/cgi-bin/twiki/pub/

It doesn't work to define $pubUrlPath as /mlmodel/cgi-bin/twiki/pub, because http://condor.wesleyan.edu/mlmodel/cgi-bin/twiki/pub is not a valid URL on this system -- I have to use the special http://mlmodel.web.wesleyan.edu/cgi-bin/twiki/pub instead. After hours of experimentation I'm convinced there is no way I can correctly configure TWiki for this system given its two special (and inconsistent) URLs. There are too many assumptions built in to TWiki's configuration mechanism about which parts of what URLs are prefixes or suffixes of which others.

I'd be delighted to be shown to be wrong about this. I'd be happy to get a workaround. I'd also like someone to think about fixing this before the actual release, because although Wesleyan's setup is particularly bizarre, it's becoming more common to use special URLs that don't directly map to the system's file structure, and there will be more problems like this.

  • TWiki version: 20020803Beta
  • Web server: Apache/1.3.12 (Unix) mod_perl/1.26 DAV/1.0.2 FrontPage/4.0.4.3
  • Server OS: SunOS 5.6
  • Web browser: IE 5.2
  • Client OS: Mac OS X

-- MitchellModel - 13 Aug 2002

Answer

TWiki currently does not support a different host name for the cgi-bin and the pub directory. TWiki builds the protocol and host name from the URL supplied by the cgi script environment and uses this for the cgi-bin path and pub path; the $defaultUrlHost is only used in case the script is not called via cgi, e.g. to tell mailnotify what host to use. That way TWiki can be used in a dual setup, for example using the http protocol if accessed from inside the firewall, and https if used from outside.

This imposes a problem in your environment where the host is different for cgi and pub. Could you check with your system administrator if the public_html directory can be accessed from the condor server? It looks like http://condor.wesleyan.edu/~USERNAME/ could work. In case yes you should be fine with this setup: [I thought that would work too, but itt doesn't -- the web server claims not to find that location, even though it correctly rewrites the URL. --- MLM]

    $defaultUrlHost   = "http://condor.wesleyan.edu";
    $scriptUrlPath    = "/cgi/mlmodel/twiki/bin";
    $pubUrlPath       = "/~mlmodel/twiki/pub";
    $pubDir           = "/home/mlmodel/public_html/twiki/pub";
    $templateDir      = "/home/mlmodel/twiki/templates";
    $dataDir          = "/home/mlmodel/twiki/data";

Note the location of $pubDir, $templateDir and $dataDir, you can place them anywhere you want as long as $pubDir is visible via http and the other two not (for securiy reasons), and you define the correct settings in TWiki.cfg.

In case you cannot access the pub from the same host as the cgi you probably need to patch TWiki.pm:

  • define a new $pubUrlHost variable, initialize it in TWiki.cfg
  • replace all occurances of $urlHost with $pubUrlHost in case it is specific to the pub directory (e.g. not cgi-bin related)

-- PeterThoeny - 13 Aug 2002

Thanks for the quick and thorough answer, Peter, especially the hints on hacking the Perl module. That's just the sort of thing I was looking for. I don't mind hacking like that, but I'm new to TWiki and I wanted some guidance on whether this change was feasible and how big a mess I would create trying to make it. (This is the sort of modification I was thinking of when I said at top that I thought the assumptions made by the TWiki configuration and scripts were too rigid with respect to the relationship between the path to the cgi-bin and path to the pub directory; it's certainly reasonable to assume their URLs have the same host, but in this case the assumption isn't valid, however bizarre a setup that may be. I'll post results in a couple of days once I disentangle this. Meanwhile, armed with this confirmation, I'm trying to convince the system guys to just give me a 'twiki' account that's more closely tied to the web server setup and doesn'thave to go through the special hacks ordinary user accounts do -- we'll see which happens first :-).

-- MitchellModel - 14 Aug 2002

Topic revision: r3 - 2002-08-14 - MitchellModel
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.