Tags:
create new tag
view all tags

SID-02189: What is a HTML document enabled directory?

Status: Answered Answered TWiki version: 6.0.2 Perl version: 5.18.2
Category: CategoryInstallation Server OS: Ubuntu 14 Last update: 9 years ago

While trying to set TWiki up on a virtual host (Apache2.4, Ubuntu 14), I managed to bring up a warning page with the message

ATTENTION: If you can access this page with a browser via http or https you have an insecure TWiki installation. Do not put TWiki into an HTML doc enabled directory. Follow the TWiki installation instructions, and use the TWiki Apache config generator to generate the twiki.conf file for the Apache webserver.

I noticed that the TWiki installation guide also warns "Don't put the whole TWiki distribution into an HTML document enabled directory." I'd like to fix this error, but I don't know what "HTML document enabled directory" means. If I search for it, I get no results, indicating that it isn't a standard technical phrase.

What precisely do you mean by "HTML document enabled directory", and how do I determine if a particular directory is one? At the very least, is there a standard technical phrase for the concept that I could use to find more information?

-- TWiki Guest - 2016-04-19

Discussion and Answer

Apache has a DocumentRoot setting that defines the director where files are served to the user. There is a global one, any one you can define per virtual host. That document root is the HTML doc enabled directory, e.g. where HTML docs are placed to deliver to the user.

-- Peter Thoeny - 2016-04-20

I recommend using the ApacheConfigGenerator to get started.

-- Peter Thoeny - 2016-04-20

That's very helpful, but I'm still confused.

My TWiki installation was previously working without any ! DocumentRoot defined anywhere outside of the default conf file. According to the TWiki installation guide, "the pub directory should be HTML document enabled". This seems to indicate that I should provide a ! DocumentRoot directive of "/var/www/twiki/pub" (in this case), but as long as everything worked I wasn't going to change anything.

In order to set up a virtual host, though, I have to specify ! DocumentRoot for TWiki. The virtual host block

<VirtualHost *>
    ServerName twiki.company.com
    DocumentRoot "/var/www/twiki/pub"
    ...
</VirtualHost>

doesn't work when I add it to twiki.conf, though. The address twiki.company.com returns the default Apache page instead of TWiki, indicating that it isn't "finding" TWiki there. Is this not the correct ! DocumentRoot for TWiki?

Thanks!

-- TWiki Guest - 2016-04-20

Apache also has an Alias directive to define additional HTML doc roots, as well as a ScriptAlias to define cgi-enabled directories. Again, run the ApacheConfigGenerator and you will be set.

-- Peter Thoeny - 2016-04-20

I did run the ApacheConfigGenerator, and I am not set.

The ApacheConfigGenerator makes no mention of virtual hosts, so I have to amend the file that it generates to define one for TWiki. This is what I'm having trouble doing. According to the Apache documenation at http://httpd.apache.org/docs/current/vhosts/name-based.html#using, I must define a <VirtualHost> block that contains a DocumentRoot directive. The Alias and ScriptAlias directives you mentioned are already there, as generated by the ApacheConfigGenerator, and as far as I can tell they're fine the way they are.

My question is, am I adding the correct DocumentRoot to twiki.conf? I.e., the pub/ directory

DocumentRoot "/var/www/twiki/pub"

for my installation. I want to rule this out as the source of the error.

-- TWiki Guest - 2016-04-21

If you have a virtual domain, use directory outside of TWiki as the document root, such as /var/www/virtualdomain1/html. TWiki would be in /var/www/virtualdomain1/twiki. In this case, do something like this:

<VirtualHost *:80>
  ServerAdmin admin@example.org
  DocumentRoot "/var/www/virtualdomain1/html"
  ServerName virtualdomain1.example.org
  ErrorLog "logs/virtualdomain1/error_log"
  CustomLog "logs/virtualdomain1/access_log" common

  <Directory "/var/www/virtualdomain1/html">
    AllowOverride None
    Order Allow,Deny
    Allow from all
    Options ExecCGI FollowSymLinks
    SetHandler cgi-script
  </Directory>

  ScriptAlias /do "/var/www/virtualdomain1/twiki/bin"
  Alias /pub "/var/www/virtualdomain1/twiki/pub"

  <Directory "/var/www/twiki/virtualdomain1/bin">
    AllowOverride None
    Order Allow,Deny
    Allow from all
    Options ExecCGI FollowSymLinks 
    SetHandler cgi-script
  </Directory>

  <Directory "/var/www/virtualdomain1/twiki/pub">
    Options None
    AllowOverride None
    Order Allow,Deny
    Allow from all
    AddType text/plain .shtml .php .php3 .phtml .phtm .pl .py .cgi
  </Directory>
</VirtualHost>

-- Peter Thoeny - 2016-04-21

Ah, this is wonderful! Thank you!

I still can't get it to work, but at least I have different problems now.

-- TWiki Guest - 2016-04-21

      Change status to:
ALERT! 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.
SupportForm
Status Answered
Title What is a HTML document enabled directory?
SupportCategory CategoryInstallation
TWiki version 6.0.2
Server OS Ubuntu 14
Web server Apache 2.4.7
Perl version 5.18.2
Browser & version Firefox 44
Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r7 - 2016-04-21 - TWikiGuest
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.