[pmwiki-users] pmwiki-users Digest, Vol 107, issue 9

Petko Yotov 5ko at 5ko.fr
Sat May 24 17:02:19 CDT 2014


Sorry for the late reply. I hope that you had the chance to browse the  
documentation of Apache and PmWiki, and to test stuff, and everything is  
probably clearer to you now. If not, read below.

Jont Allen writes:
> This is a "resend" as I had the wrong "Reply-To"

I suppose that if users who ask questions to the mailing list disable the  
"Digest" mode, they will receive the replies faster. This will also make it  
easier for all readers, as the subsequent questions and replies will not  
break the threads in people's e-mail software and in the mailing list  
archives - and this would be very very kind.

This is not an obligation, just an observation.

> I am very happy to try again, but there are SO many possibilities, that I  
> couldnt try them all. Furthermore I was confused about several things, that  
> I suspect/hope you can clear up immediately.
>
> Can we go 1 step at a time?
>
> That first step is apache config.
> The second step is the wiki config.
>
> I attache my config.php stripped of comments. I had tried

You have attached a file listing your passwords in clear. I suggest you  
change them ASAP and read the page PasswordsAdmin on how to store encrypted  
hashes of the passwords into config.php.

If you use the same passwords for other accounts (e-mail, banking,  
paypal...) you should change them everywhere.

>   $EnablePathInfo = 1;
> along with "alias /wiki"
> but that was the line that seemed to introduce the instability wrt skins.  
> The skin problem was for everything, not just uploads. The skins randomly  
> stopped working once I added this option.
>
> 1) You mention the index.php:.
> WHAT I HAVE NOW: /var/www/index.php
> <?php chdir('./wiki/'); include_once('pmwiki.php');
>
> In the past: /var/www/wiki/index.php contained
>   <?php include_once('pmwiki.php');
> but it had no effect so I removed it.

Because your $ScriptUrl variable wasn't configured to use it.


> There is a: /var/www/wiki/pmwiki.php

Do not modify this file or any file in the scripts directory.


> 2) These lines are commented and dont seem relevant to my problems:
>  > ## uncomment below if skins/attached files seem broken
>  > # $FarmPubDirUrl = $PubDirUrl =  
> 'http://hear.beckman.illinois.edu/wiki/pub';
>  > # $UploadUrlFmt = 'http://hear.beckman.illinois.edu/wiki/uploads';

Indeed, they are commented out. I wrote to uncomment them if you have  
problems with the appearance of skins and downloading of attached files.

> 3) I own the system and have root, so I configure apache directly, with the  
> config file rather than use .htaccess? From my reading of the docs, apache  
> strong recomends that the admin (me) config apache, rather than scatter  
> about many .htaccess files. Is that your understanding as well? In  

Yes. But the .htaccess file is very specific to the PmWiki installation you  
have, so you may find it better to have PmWiki-specific configuration files  
near the PmWiki installation, rather than scattered about in /var/www,  
/etc/apache2, and/or elsewhere.

> otherwords, what ever can go in a .htaccess file, can alternatively go in  
> the config file. I have been operating under this guidance by the apache  
> docs. If my assumption is wrong, where do I put the .htaccess file, in  
> /var/www/ or /var/www/wiki/ ?

In /var/www - the DOCUMENT_ROOT of Apache.

> So my assumption, and question is, can I put all the rewrite rules in the  
> apache config file? I'm asking about the following rules:

Yes, but it is probably better to keep them with the PmWiki installation,  
and to keep your Apache installation as close to the standard as possible. I  
would. This way, if some day you need to migrate your wiki to a different  
hosting, eg. a faster/larger server or a low cost shared hosting provider,  
your wiki will work very easily.

> RewriteEngine On
> RewriteBase /
> RewriteRule ^$       /wiki/pmwiki.php  [QSA,L]
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteCond %{REQUEST_FILENAME} !-l
> RewriteRule ^([A-Z0-9\x80-\xFF].*)$ /wiki/pmwiki.php?n=$1 [QSA,L]
>
> I did not try this, mostly because I didn't understand it.

All these rules are explained in the page CleanUrls which you said you read.  
Which of the above line(s) are not suffuciently documented in  
Cookbook/CleanUrls?

> I am very happy  
> to do it, but would like to keep all such rules in one place, such as the  
> config file. Else it all becomes so scattered I cant figure out whats going  
> on 6 mos from now.

You have root access, and there is a detailed free documentation of Apache  
so you can read the documentation and configure it the way you want.

Or, you don't change anything in Apache config (or the strict minimum), and  
keep all PmWiki-related configuration in one place: /var/www .


> 2) On my ubuntu system, this apache config file is:
> /etc/apache2/sites-available/default
> In that file I have placed the following lines (plus many others ...):
>
> <VirtualHost *:80>
>          ServerAdmin jont at mimosaacoustics.com
>
>          DocumentRoot /var/www
>
> <IfModule mod_access.c>
>      <Files ~ "^\.ht">
>          Order allow,deny
>          Deny from all
>      </Files>
> </IfModule>
>
> ...
>
> #block .htaccess:                      <--- note these are commented out
> #               AllowOverride None
> #               Order allow,deny
> #               allow from all
> #       </Directory>
>
> ... blah blah

The above ones are pretty standard and you can read about every line in the  
excellent Apache documentation. These below are not, are probably not needed  
and/or may be dangerous.


> #PMWIKI JBA
> #JBA changed -Indexes to +Indexes so to see ECE493...
>          <Directory /var/www/wiki/>
>                  Options +Indexes FollowSymLinks MultiViews
>                  AllowOverride None
>                  Order allow,deny
>                  allow from All
>          </Directory>

This is not needed and potentially dangerous as it unprotects locally  
protected directories.


> # this is where the main problem seems to be:  <--NOTE comment
> #This almost worked but was unstable, The skins to randomly failed.
> # "Alias /wiki ..." worked with $EnablePathInfo = 1;,
> # Alias lines:
> # <IfModule mod_alias.c>
> #  Alias /wiki /var/www/wiki/pmwiki.php
> # </IfModule>

If you use RewriteRules instead of Alias, your installation will be more  
portable, as more hosting providers allow URL rewriting than Aliases.

>          <Directory /var/www/wiki.d/>
>                  Options +Indexes FollowSymLinks MultiViews
>                  AllowOverride None
>                  Order allow,deny
>                  allow from All
>          </Directory>

This one wiki.d needs to be removed or changed. You actually leave your  
wiki.d directory unprotected and anyone can get all pages and history  
without any password.


>         <Directory /var/www/wiki/Courses/ECE5372013SpeechProcessing/>
>                  Options +Indexes FollowSymLinks MultiViews
>                  AllowOverride None
>                  Order allow,deny
>                  allow from All
>          </Directory>

This is not needed, there is no such directory.


>          <Directory /var/www/wiki/uploads/>
>                  Options -Indexes FollowSymLinks
>                  Allow from All
>          </Directory>

This is not needed, and if some day you want to protect downloads, this will  
keep them unprotected.

Petko


>
> On 05/21/2014 12:00 PM, pmwiki-users-request at pmichaud.com wrote:
> > Send pmwiki-users mailing list submissions to
> >     pmwiki-users at pmichaud.com
> >
> > Today's Topics:
> >
> >     1. Re: pmwiki-users Digest, Vol 107, Issue 8 (Petko Yotov)
> >
> >
> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Wed, 21 May 2014 06:38:57 +0200
> > From: Petko Yotov <5ko at 5ko.fr>
> > To: pmwiki-users at pmichaud.com
> > Subject: Re: [pmwiki-users] pmwiki-users Digest, Vol 107, Issue 8
> > Message-ID: <cone.1400647137.558773.1170.1000 at pc4>
> > Content-Type: text/plain; format=flowed; delsp=yes; charset="UTF-8"
> >
> > I've been using the URL rewriting method on many sites for many years.
> >
> > Here is an example .htaccess file that may work for you:
> >
> > RewriteEngine On
> > RewriteBase /
> > RewriteRule ^$       /wiki/pmwiki.php  [QSA,L]
> > RewriteCond %{REQUEST_FILENAME} !-f
> > RewriteCond %{REQUEST_FILENAME} !-d
> > RewriteCond %{REQUEST_FILENAME} !-l
> > RewriteRule ^([A-Z0-9\x80-\xFF].*)$ /wiki/pmwiki.php?n=$1 [QSA,L]
> >
> > This is like the Example 2 on the CleanUrls page, modified to match your
> > directory name (wiki instead of pmwiki) and your lack of index.php file.
> >
> > And, in config.php, set these variables:
> >
> > # set clean urls hear.beckman.illinois.edu/Courses/ECE537
> > $EnablePathInfo = 1;
> > $ScriptUrl = 'http://hear.beckman.illinois.edu';
> >
> > ## uncomment below if skins/attached files seem broken
> > # $FarmPubDirUrl = $PubDirUrl =  
> 'http://hear.beckman.illinois.edu/wiki/pub';
> > # $UploadUrlFmt = 'http://hear.beckman.illinois.edu/wiki/uploads';
> >
> > Petko
> >
> > Jont Allen writes:
> >> Dear Petko,
> >> I tried all the methods on
> >> http://www.pmwiki.org/wiki/Cookbook/CleanUrls
> >>
> >> The alias method looked like it was going to work, but was unstable. I  
> would
> >> get an error, and then the skin was lost, and I had to turn off the alias  
> to
> >> recover. It also stopped rendering the LaTeX scripts.
> >> I just couldn't get it to be stable.
> >>
> >> In the end, the best I could do is
> >> http://hear.beckman.illinois.edu/?n=Courses.ECE537-2013SpeechProcessing
> >>
> >> There are two problems: I cannot get rid of "/n=" and
> >>    Courses.ECE537
> >> should have been
> >>    Courses/ECE537
> >>
> >> The . -> / is not a big deal, but I would really love to remove the "/n="  
> as
> >> students will be confused by this syntax.
> >>
> >> The option
> >> $EnablePathInfo = 1;
> >> did not do it once I got rid of the /wiki/config.php/ part of the URL.
> >>
> >> Are there more robust methods of doing this?
> >>
> >> Jont Allen
> >>
> >>




More information about the pmwiki-users mailing list