AgileApps Support Wiki Pre Release

Difference between revisions of "User:Aeric/Apache Notes"

From AgileApps Support Wiki
imported>Aeric
(Created page with "<noinclude>__TOC__</noinclude> ===Commands=== RedHat commands worth knowing: :* <tt>service httpd restart</tt> - Restart Apache (generally unnecessary. Sometimes useful, "just to…")
 
imported>Aeric
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>__TOC__</noinclude>
<noinclude>__TOC__</noinclude>
===Commands===
====Commands====
RedHat commands worth knowing:
RedHat commands worth knowing:
:* <tt>service httpd restart</tt> - Restart Apache (generally unnecessary. Sometimes useful, "just to be sure")
:* <tt>service httpd restart</tt> - Restart Apache (generally unnecessary. Sometimes useful, "just to be sure")
:* <tt>service httpd reload</tt> - Reload the configuration files
:* <tt>service httpd reload</tt> - Reload the configuration files


===mediawiki.conf===
====mediawiki.conf====
The configuration file for MediaWiki is <tt>/etc/httpd/conf.d. mediawiki.conf</tt>, where:
The configuration file for MediaWiki is <tt>/etc/httpd/conf.d. mediawiki.conf</tt>, where:
:* '''etc''' (''eht-cee'') is the "et cetera" container for stuff added to the system
:* '''etc''' (''eht-cee'') is the "et cetera" container for stuff added to the system
Line 11: Line 11:
:* '''conf.d''' is the directory of configuration files (all files in this directory are read by Apache when it starts or reloads.)
:* '''conf.d''' is the directory of configuration files (all files in this directory are read by Apache when it starts or reloads.)


Contents of that file:
{{Important|<br>''All'' files in that directory are processed, so make backup files elsewhere.}}
:<syntaxhighlight lang="php" enclose="div" style="overflow: auto">
# Mediawiki
#
# Allows only localhost by default


# CAN'T MATCH THE QUERY STRING:
====About that query string====
#  "The regular expression pattern is matched against the URL-Path of
#    the incoming request (the part after the hostname but *before* any
#    question mark indicating the beginning of a query string)."
#      --so we can easily convert short URLs to MediaWiki long form
#      --but without a way to parse the query string for its parts,
#        there is no way to go in the other direction.
##RedirectMatch 301  ^/(.+)/index.php?title=(.*)$            /$1/$2
 
# Convert {domain] references to {domain}/wiki references
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/wiki/.*
RewriteRule ^/(.*)$  /wiki/$1  [PT,QSA]  # root => wiki
 
# Point /wiki URLs to the current-version directory
Alias /wiki /usr/share/mediawiki/lj80
<Directory /usr/share/mediawiki/lj80>
  order allow,deny
  allow from all
 
  # Allow directories to be browsed, except for some that are hidden
  # due to corporate branding or functionality not exposed to ISVs.
  #
  Options Indexes FollowSymLinks MultiViews
  IndexIgnore download/files download/jars download/whitepapers
 
  # In a directory, the URI does NOT begin with a slash. (Outside, it does.)
  RewriteEngine on                              # "As-Is" Links:
  RewriteRule ^wiki_tests.php - [NC,L]          #  Link-test URL
  RewriteRule ^info.php - [NC,L]                #  Special-page URL
  RewriteRule ^(images|skins|extensions|download)/ - [NC,L] # Scripts & files
 
  # Quietly convert short URLs to the long form, so MediaWiki
  # finds the pages:
  #    index page => 1st MW page
  #    other urls => MW pages
  #    root URL  => 1st MW page
  RewriteRule ^index.php$ index.php?title=Main_Page [NC,L,QSA]
  RewriteRule ^(.+)$      index.php?title=$1        [NC,L,QSA] 
  RewriteRule ^$          index.php?title=Main_Page [NC,L,QSA] 
</Directory>
 
Alias /lj80 /usr/share/mediawiki/lj80
Alias /lj81 /usr/share/mediawiki/lj81
 
<VirtualHost *>
ServerName www.platformatyourservice.com
DocumentRoot /usr/share/mediawiki/lj80
ServerAlias    att.platformatyourservice.com
ServerAlias    lj.platformatyourservice.com
ServerAlias    isv.platformatyourservice.com
ServerAlias    rn.platformatyourservice.com
ServerAlias custom.platformatyourservice.com
ServerAlias  test.platformatyourservice.com
</VirtualHost>
</syntaxhighlight>
 
===About that query string===
;Motivation:Pages with plain names seem to work properly. The incoming link is converted to the short URL form, and TOC entries have that form, as well.
;Motivation:Pages with plain names seem to work properly. The incoming link is converted to the short URL form, and TOC entries have that form, as well.


:But bookmarks that go to old pages that have :, /, or ! in them don't get a URL rewrite, because those characters don't seem to be handled by the segment-at-time matching rules. (They must be MediaWiki matching rules, because Apache is *not* doing the redirect. MediaWiki is.)
:But bookmarks that go to old pages that have :, /, or ! in them don't get a URL rewrite, because those characters don't seem to be handled by the URL-segment-at-a-time matching rules. (They must be MediaWiki matching rules, because Apache is *not* doing the redirect. MediaWiki is.)


;Idea:We *could* make a redirect.php page that parses the query string, creates the new URL, and sends a 301-redirect back to the browser. That would be cool. But it's a fair amount of work for a few special pages that, over time, will no longer be bookmarked.
;Idea:We ''could'' make a redirect.php page that parses the query string, creates the new URL, and sends a 301-redirect back to the browser. That would be cool. But it's a fair amount of work for a few special pages that, over time, will no longer be bookmarked.

Latest revision as of 22:43, 4 September 2013

Commands

RedHat commands worth knowing:

  • service httpd restart - Restart Apache (generally unnecessary. Sometimes useful, "just to be sure")
  • service httpd reload - Reload the configuration files

mediawiki.conf

The configuration file for MediaWiki is /etc/httpd/conf.d. mediawiki.conf, where:

  • etc (eht-cee) is the "et cetera" container for stuff added to the system
  • httpd is the HTTP Daemon (Apache)
  • conf.d is the directory of configuration files (all files in this directory are read by Apache when it starts or reloads.)

Warn.png

Important:
All files in that directory are processed, so make backup files elsewhere.

About that query string

Motivation
Pages with plain names seem to work properly. The incoming link is converted to the short URL form, and TOC entries have that form, as well.
But bookmarks that go to old pages that have :, /, or ! in them don't get a URL rewrite, because those characters don't seem to be handled by the URL-segment-at-a-time matching rules. (They must be MediaWiki matching rules, because Apache is *not* doing the redirect. MediaWiki is.)
Idea
We could make a redirect.php page that parses the query string, creates the new URL, and sends a 301-redirect back to the browser. That would be cool. But it's a fair amount of work for a few special pages that, over time, will no longer be bookmarked.