Added Local Settings and Short URLs
Install in /w for Short URLs, add LocalSettings.php template and added rewrite rules
This commit is contained in:
parent
9a6e6a0d43
commit
c811a28e03
@ -22,6 +22,12 @@
|
||||
path: "{{ mw_dir }}/public_html"
|
||||
state: directory
|
||||
|
||||
# https://www.mediawiki.org/wiki/Manual:Short_URL#Moving_a_wiki_from_/wiki_to_/w
|
||||
- name: Create Directory /w for Short URLs
|
||||
file:
|
||||
path: "{{ mw_dir }}/public_html/w"
|
||||
state: directory
|
||||
|
||||
- name: Create Logs Directory
|
||||
file:
|
||||
path: "{{ mw_dir }}/logs"
|
||||
@ -37,12 +43,17 @@
|
||||
- name: Extract MediaWiki
|
||||
unarchive:
|
||||
src: /tmp/mediawiki-{{ mw_version }}.tar.gz
|
||||
dest: "{{ mw_dir }}/public_html"
|
||||
dest: "{{ mw_dir }}/public_html/w"
|
||||
owner: www-data
|
||||
group: www-data
|
||||
extra_opts: [--strip-components=1]
|
||||
remote_src: yes
|
||||
|
||||
- name: Apply LocalSettings.php
|
||||
template:
|
||||
src: LocalSettings.php.j2
|
||||
dest: "{{ mw_dir }}/public_html/w/LocalSettings.php"
|
||||
|
||||
- name: Apply Apache Configuration
|
||||
template:
|
||||
src: mediawiki.conf.j2
|
||||
|
186
roles/mediawiki/templates/LocalSettings.php.j2
Normal file
186
roles/mediawiki/templates/LocalSettings.php.j2
Normal file
@ -0,0 +1,186 @@
|
||||
<?php
|
||||
# This file was automatically generated by the MediaWiki 1.33.0
|
||||
# installer. If you make manual changes, please keep track in case you
|
||||
# need to recreate them later.
|
||||
#
|
||||
# See includes/DefaultSettings.php for all configurable settings
|
||||
# and their default values, but don't forget to make changes in _this_
|
||||
# file, not there.
|
||||
#
|
||||
# Further documentation for configuration settings may be found at:
|
||||
# https://www.mediawiki.org/wiki/Manual:Configuration_settings
|
||||
|
||||
# Protect against web entry
|
||||
if ( !defined( 'MEDIAWIKI' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
## Uncomment this to disable output compression
|
||||
# $wgDisableOutputCompression = true;
|
||||
|
||||
$wgSitename = "{{ mw_sitename }}";
|
||||
$wgMetaNamespace = "{{ mw_namespace }}";
|
||||
|
||||
## The URL base path to the directory containing the wiki;
|
||||
## defaults for all runtime URL paths are based off of this.
|
||||
## For more information on customizing the URLs
|
||||
## (like /w/index.php/Page_title to /wiki/Page_title) please see:
|
||||
## https://www.mediawiki.org/wiki/Manual:Short_URL
|
||||
|
||||
$wgScriptPath = "/w";
|
||||
$wgScriptExtension = ".php";
|
||||
$wgArticlePath = "/wiki/$1";
|
||||
|
||||
## The protocol and server name to use in fully-qualified URLs
|
||||
$wgServer = "http://{{ mw_domain }}";
|
||||
|
||||
## The URL path to static resources (images, scripts, etc.)
|
||||
$wgResourceBasePath = $wgScriptPath;
|
||||
|
||||
## The URL path to the logo. Make sure you change this from the default,
|
||||
## or else you'll overwrite your logo when you upgrade!
|
||||
$wgLogo = "$wgResourceBasePath/resources/assets/wiki.png";
|
||||
#$wgLogo = "/logo.png";
|
||||
|
||||
## UPO means: this is also a user preference option
|
||||
|
||||
$wgEnableEmail = false;
|
||||
$wgEnableUserEmail = true; # UPO
|
||||
|
||||
$wgEmergencyContact = "apache@{{ mw_domain }}";
|
||||
$wgPasswordSender = "apache@{{ mw_domain }}";
|
||||
|
||||
$wgEnotifUserTalk = false; # UPO
|
||||
$wgEnotifWatchlist = false; # UPO
|
||||
$wgEmailAuthentication = true;
|
||||
|
||||
## Database settings
|
||||
$wgDBtype = "mysql";
|
||||
$wgDBserver = "{{ mw_db_host }}";
|
||||
$wgDBname = "{{ mw_db_name }}";
|
||||
$wgDBuser = "{{ mw_db_user }}";
|
||||
$wgDBpassword = "{{ mw_db_pass }}";
|
||||
|
||||
# MySQL specific settings
|
||||
$wgDBprefix = "";
|
||||
|
||||
# MySQL table options to use during installation or update
|
||||
$wgDBTableOptions = "ENGINE=InnoDB, DEFAULT CHARSET=binary";
|
||||
|
||||
## Shared memory settings
|
||||
$wgMainCacheType = CACHE_ACCEL;
|
||||
$wgMemCachedServers = [];
|
||||
|
||||
## To enable image uploads, make sure the 'images' directory
|
||||
## is writable, then set this to true:
|
||||
$wgEnableUploads = true;
|
||||
$wgGenerateThumbnailOnParse = false;
|
||||
$wgUseImageMagick = true;
|
||||
$wgImageMagickConvertCommand = "/usr/bin/convert";
|
||||
|
||||
# InstantCommons allows wiki to use images from https://commons.wikimedia.org
|
||||
$wgUseInstantCommons = true;
|
||||
|
||||
# Periodically send a pingback to https://www.mediawiki.org/ with basic data
|
||||
# about this MediaWiki instance. The Wikimedia Foundation shares this data
|
||||
# with MediaWiki developers to help guide future development efforts.
|
||||
$wgPingback = true;
|
||||
|
||||
## If you use ImageMagick (or any other shell command) on a
|
||||
## Linux server, this will need to be set to the name of an
|
||||
## available UTF-8 locale
|
||||
$wgShellLocale = "C.UTF-8";
|
||||
|
||||
## Set $wgCacheDirectory to a writable directory on the web server
|
||||
## to make your wiki go slightly faster. The directory should not
|
||||
## be publicly accessible from the web.
|
||||
#$wgCacheDirectory = "$IP/cache";
|
||||
|
||||
# Site language code, should be one of the list in ./languages/data/Names.php
|
||||
$wgLanguageCode = "en";
|
||||
|
||||
$wgSecretKey = "{{ lookup('password', '/dev/null length=64 chars=hexdigits') }}";
|
||||
|
||||
# Changing this will log out all existing sessions.
|
||||
$wgAuthenticationTokenVersion = "{{ lookup('password', '/dev/null length=64 chars=hexdigits') }}";
|
||||
|
||||
# Site upgrade key. Must be set to a string (default provided) to turn on the
|
||||
# web installer while LocalSettings.php is in place
|
||||
$wgUpgradeKey = "{{ lookup('password', '/dev/null length=16 chars=hexdigits') }}";
|
||||
|
||||
## For attaching licensing metadata to pages, and displaying an
|
||||
## appropriate copyright notice / icon. GNU Free Documentation
|
||||
## License and Creative Commons licenses are supported so far.
|
||||
$wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright
|
||||
$wgRightsUrl = "https://creativecommons.org/licenses/by-sa/4.0/";
|
||||
$wgRightsText = "Creative Commons Attribution-ShareAlike";
|
||||
$wgRightsIcon = "$wgResourceBasePath/resources/assets/licenses/cc-by-sa.png";
|
||||
|
||||
# Path to the GNU diff3 utility. Used for conflict resolution.
|
||||
$wgDiff3 = "/usr/bin/diff3";
|
||||
|
||||
## Default skin: you can change the default skin. Use the internal symbolic
|
||||
## names, ie 'vector', 'monobook':
|
||||
$wgDefaultSkin = "vector";
|
||||
|
||||
# Enabled skins.
|
||||
# The following skins were automatically enabled:
|
||||
wfLoadSkin( 'MonoBook' );
|
||||
wfLoadSkin( 'Timeless' );
|
||||
wfLoadSkin( 'Vector' );
|
||||
|
||||
|
||||
# Enabled extensions. Most of the extensions are enabled by adding
|
||||
# wfLoadExtensions('ExtensionName');
|
||||
# to LocalSettings.php. Check specific extension documentation for more details.
|
||||
# The following extensions were automatically enabled:
|
||||
wfLoadExtension( 'CodeEditor' );
|
||||
wfLoadExtension( 'ConfirmEdit' );
|
||||
wfLoadExtension( 'MultimediaViewer' );
|
||||
wfLoadExtension( 'PdfHandler' );
|
||||
wfLoadExtension( 'SpamBlacklist' );
|
||||
wfLoadExtension( 'TitleBlacklist' );
|
||||
wfLoadExtension( 'WikiEditor' );
|
||||
|
||||
|
||||
# End of automatically generated settings.
|
||||
# Add more configuration options below.
|
||||
|
||||
|
||||
# IP restictions
|
||||
if ($_SERVER['REMOTE_ADDR'] != '{{ mw_iplock }}') {
|
||||
$wgGroupPermissions['*']['createaccount'] = false;
|
||||
$wgGroupPermissions['*']['edit'] = false;
|
||||
}
|
||||
|
||||
|
||||
# MobileFrontend
|
||||
#wfLoadExtension( 'MobileFrontend' );
|
||||
#wfLoadSkin( 'Vector' );
|
||||
#$wgMFDefaultSkinClass = 'SkinVector';
|
||||
|
||||
# VisualEditor
|
||||
#wfLoadExtension( 'VisualEditor' );
|
||||
|
||||
# Syntax highlighting
|
||||
#wfLoadExtension( 'SyntaxHighlight_GeSHi' );
|
||||
|
||||
// Enable by default for everybody
|
||||
$wgDefaultUserOptions['visualeditor-enable'] = 1;
|
||||
|
||||
// Optional: Set VisualEditor as the default for anonymous users
|
||||
// otherwise they will have to switch to VE
|
||||
// $wgDefaultUserOptions['visualeditor-editor'] = "visualeditor";
|
||||
|
||||
// Don't allow users to disable it
|
||||
$wgHiddenPrefs[] = 'visualeditor-enable';
|
||||
|
||||
// OPTIONAL: Enable VisualEditor's experimental code features
|
||||
// #$wgDefaultUserOptions['visualeditor-enable-experimental'] = 1;
|
||||
|
||||
$wgVirtualRestConfig['modules']['parsoid'] = [
|
||||
'url' => 'http://localhost:8142',
|
||||
];
|
||||
|
||||
$wgShowExceptionDetails = true;
|
@ -4,6 +4,18 @@
|
||||
ServerAdmin {{ mw_admin_email }}
|
||||
DocumentRoot {{ mw_dir }}/public_html
|
||||
|
||||
RewriteEngine On
|
||||
RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L]
|
||||
RewriteRule ^/?$ %{DOCUMENT_ROOT}/w/index.php [L]
|
||||
|
||||
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
|
||||
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
|
||||
RewriteRule ^/?w/images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/w/thumb.php?f=$1&width=$2 [L,QSA,B]
|
||||
|
||||
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
|
||||
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
|
||||
RewriteRule ^/?w/images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/w/thumb.php?f=$1&width=$2&archived=1 [L,QSA,B]
|
||||
|
||||
ErrorLog {{ mw_dir }}/logs/error.log
|
||||
CustomLog {{ mw_dir }}/logs/access.log combined
|
||||
</VirtualHost>
|
||||
|
Loading…
Reference in New Issue
Block a user