MediaWiki configuration
- MediaWiki Configuration: A Beginner's Guide
This article provides a comprehensive introduction to configuring a MediaWiki installation, targeted towards beginners. MediaWiki, the software powering Wikipedia and countless other wikis, is highly customizable. Understanding its configuration is key to tailoring your wiki to your specific needs. We will cover the core configuration files, common settings, and methods for making changes.
Understanding the Configuration Files
MediaWiki's configuration is primarily managed through PHP files located in the `config/` directory of your MediaWiki installation. The most important files are:
- `LocalSettings.php`: This is the *main* configuration file. It's where you set database connection details, site name, logo, language, and a vast number of other parameters. This file *must* exist and be correctly configured for MediaWiki to function.
- `DefaultSettings.php`: This file contains default settings. You should *not* directly edit this file. Instead, override the defaults in `LocalSettings.php`. Editing `DefaultSettings.php` directly will be overwritten during MediaWiki updates.
- `Maintenance/config.php`: Used primarily during maintenance tasks like database upgrades. It’s not usually modified for standard operation.
Setting up LocalSettings.php
The `LocalSettings.php` file is the heart of your MediaWiki configuration. Here's a breakdown of the essential settings you'll need to configure:
1. **Database Configuration:** This is the first and most critical step. MediaWiki supports various database systems, including MySQL/MariaDB, PostgreSQL, and SQLite. The following code snippet demonstrates a typical MySQL/MariaDB configuration (replace the placeholders with your actual database credentials):
```php $wgDBtype = 'mysqli'; $wgDBserver = 'localhost'; $wgDBname = 'your_database_name'; $wgDBuser = 'your_database_user'; $wgDBpassword = 'your_database_password'; $wgDBprefix = 'mw_'; # Prefix for table names (optional, but recommended) ```
* `$wgDBtype`: Specifies the database type. * `$wgDBserver`: The database server address. * `$wgDBname`: The name of the database. * `$wgDBuser`: The database username. * `$wgDBpassword`: The database password. * `$wgDBprefix`: A prefix to avoid table name collisions if multiple MediaWiki installations share the same database.
2. **Site Information:** Define the core identity of your wiki:
```php $wgSitename = 'Your Wiki Name'; $wgMetaDirectory = '/wiki'; # The directory where your wiki is located (important for URL rewriting) $wgScriptPath = '/wiki/index.php'; # The path to the index file $wgUploadDirectory = '/images'; # Directory for uploaded files ```
* `$wgSitename`: The name of your wiki, displayed in the page title. * `$wgMetaDirectory`: The URL path to your wiki. Crucial for proper URL generation. * `$wgScriptPath`: The path to the `index.php` file, the entry point for all wiki requests. * `$wgUploadDirectory`: The directory where users can upload files.
3. **Language Configuration:**
```php $wgLanguageCode = 'en'; # Set the default language ```
* `$wgLanguageCode`: Sets the default language for the wiki interface. Ensure the corresponding language files are installed (located in the `languages/` directory). See Localization for more details.
4. **Authentication and User Management:**
```php $wgPassCrypt = 'sha512'; # Password encryption algorithm. sha512 is recommended. $wgCookieDomain = 'yourdomain.com'; # Set the cookie domain (important for security) $wgCookiePath = '/'; # Set the cookie path $wgCookieSecure = true; # Require a secure connection (HTTPS) for cookies ```
* `$wgPassCrypt`: Specifies the algorithm used to encrypt user passwords. `sha512` is the most secure option. * `$wgCookieDomain`: Restricts cookie access to a specific domain, enhancing security. * `$wgCookiePath`: Defines the path for which the cookie is valid. * `$wgCookieSecure`: Ensures cookies are only transmitted over HTTPS.
5. **Email Configuration:** For sending email notifications (e.g., password resets):
```php $wgEnableEmail = true; $wgSMTPserver = 'smtp.yourmailserver.com'; $wgSMTPport = 587; $wgSMTPuser = 'your_email_address'; $wgSMTPpassword = 'your_email_password'; $wgSMTPssl = true; # Use SSL encryption ```
* `$wgEnableEmail`: Enables email functionality. * `$wgSMTPserver`, `$wgSMTPport`, `$wgSMTPuser`, `$wgSMTPpassword`, `$wgSMTPssl`: Configure the settings for your SMTP server.
6. **Caching Configuration:**
```php $wgMainCacheType = CACHE_MEMCACHED; # Or CACHE_REDIS, CACHE_ACCELERATOR, CACHE_DB $wgMemCachedServers = array( '127.0.0.1:11211' ); # Memcached server(s) ```
* `$wgMainCacheType`: Sets the main cache type. Memcached and Redis are highly recommended for performance. * `$wgMemCachedServers`: Specifies the Memcached server(s) addresses.
Important Configuration Variables
Here’s a more detailed look at some other frequently used configuration variables:
- `$wgSitename`: (already explained)
- `$wgLogo`: Sets the URL of the wiki logo. Example: `$wgLogo = '/images/logo.png';`
- `$wgFavicon`: Sets the URL of the favicon.
- `$wgEnableWikiFarm`: Enables the wiki farm feature (allowing multiple wikis under a single installation).
- `$wgUsePathInfo`: Enables or disables the use of `PATH_INFO` for cleaner URLs. Generally recommended to be set to `true`.
- `$wgArticlePath`: The path to the article pages (usually `/wiki/$1`).
- `$wgUploadPath`: The path to the uploaded files (usually `/images`).
- `$wgScriptExtension`: The extension of the index file (usually `.php`).
- `$wgShowExceptionDetails`: Displays detailed error messages (useful for debugging, but disable in production).
- `$wgMaintenanceMode`: Enables maintenance mode, preventing users from editing the wiki.
- `$wgDisableEmail`: Disables all email sending.
- `$wgRateLimits`: Configure rate limits to prevent abuse. See Abuse Filtering for more information.
- `$wgSpamRegex`: Regular expressions used to detect and block spam.
- `$wgDisableWikipageEdit`: Disables the editing of wiki pages.
- `$wgEnableCategories`: Enables the use of categories.
- `$wgEnableTalkPages`: Enables talk pages for articles.
Extending MediaWiki Functionality with Extensions
MediaWiki's functionality can be drastically extended using extensions.
1. **Downloading Extensions:** Extensions are downloaded from the [MediaWiki Extension Directory](https://www.mediawiki.org/wiki/Extension_directory). 2. **Installation:** Place the extension files in the `extensions/` directory. 3. **Configuration:** Most extensions require configuration in `LocalSettings.php`. The extension documentation will provide specific instructions. For example:
```php require_once "$IP/extensions/ExampleExtension/ExampleExtension.php"; ```
* Replace `ExampleExtension` with the name of the extension.
Some popular extensions include:
- Semantic MediaWiki: Adds semantic capabilities to wikis.
- VisualEditor: Provides a WYSIWYG editor.
- Abuse Filtering: Helps prevent vandalism and spam.
- OAuth2: Enables authentication via OAuth2 providers.
- Maps: Adds map functionality to pages.
Skin Configuration
MediaWiki supports multiple skins, controlling the visual appearance of your wiki.
- **Selecting a Skin:** Users can choose their preferred skin in their user preferences.
- **Default Skin:** Set the default skin in `LocalSettings.php`:
```php $wgDefaultSkin = 'Vector'; # Or 'MonoBook', 'Modern', etc. ```
- **Installing Skins:** Skins are installed similarly to extensions – place the skin files in the `skins/` directory.
URL Rewriting & .htaccess
For clean URLs (removing `index.php` from the address), you need to configure your web server (Apache or Nginx). For Apache, this typically involves creating or modifying a `.htaccess` file in the root directory of your MediaWiki installation. A basic `.htaccess` configuration might look like this:
```apache RewriteEngine On RewriteBase /wiki RewriteRule ^(.*)$ index.php?title=$1 [L] ```
* Adjust `RewriteBase` to match your `$wgMetaDirectory` setting.
For Nginx, the configuration is more complex and requires modifying the server block configuration. Refer to the official MediaWiki documentation for detailed Nginx configuration instructions. See Configuration Formats for more information.
Debugging Configuration Issues
- **Check the Error Logs:** MediaWiki logs errors to the `error.log` file in the `wmf-config/` directory (or as configured in `LocalSettings.php`).
- **Enable Debugging:** Set `$wgShowExceptionDetails = true;` in `LocalSettings.php` to display detailed error messages on the screen (only for development).
- **PHP Errors:** Ensure PHP error reporting is enabled in your `php.ini` file.
- **Browser Developer Tools:** Use your browser's developer tools to inspect network requests and identify any errors.
Security Best Practices
- **Keep MediaWiki Updated:** Regularly update to the latest version to benefit from security patches.
- **Strong Passwords:** Enforce strong passwords for all users.
- **HTTPS:** Use HTTPS to encrypt communication between the server and users.
- **Limit Access:** Restrict access to the `config/` directory and other sensitive files.
- **Regular Backups:** Create regular backups of your database and files.
- **Abuse Filtering:** Implement and configure abuse filtering to prevent vandalism and spam.
- **Rate Limiting:** Implement rate limiting to prevent brute-force attacks.
Advanced Configuration
Beyond the basics, MediaWiki offers extensive advanced configuration options. These include:
- **Hooks:** Allow you to intercept and modify MediaWiki's behavior.
- **API:** Provides a programmatic interface for interacting with the wiki.
- **Database Replication:** Improves performance and reliability by replicating the database.
- **Clustering:** Distributes the load across multiple servers.
- **Customizing the Interface with CSS and JavaScript:** Modify the look and feel of your wiki.
Understanding these advanced concepts will allow you to create a highly customized and powerful wiki. Refer to the official MediaWiki documentation for more details.
Resources
- [MediaWiki Official Documentation](https://www.mediawiki.org/wiki/Manual:Configuration_settings)
- [MediaWiki Extension Directory](https://www.mediawiki.org/wiki/Extension_directory)
- [MediaWiki Localization](https://www.mediawiki.org/wiki/Manual:Localization)
- [Abuse Filtering](https://www.mediawiki.org/wiki/Manual:Abuse_filtering)
- [Configuration Formats](https://www.mediawiki.org/wiki/Manual:Configuration_formats)
- [Trading Strategies](https://www.investopedia.com/terms/t/tradingstrategy.asp)
- [Technical Analysis](https://corporatefinanceinstitute.com/resources/knowledge/trading-investing/technical-analysis/)
- [Moving Averages](https://www.investopedia.com/terms/m/movingaverage.asp)
- [Relative Strength Index (RSI)](https://www.investopedia.com/terms/r/rsi.asp)
- [MACD](https://www.investopedia.com/terms/m/macd.asp)
- [Bollinger Bands](https://www.investopedia.com/terms/b/bollingerbands.asp)
- [Fibonacci Retracements](https://www.investopedia.com/terms/f/fibonacciretracement.asp)
- [Candlestick Patterns](https://www.investopedia.com/terms/c/candlestick.asp)
- [Trend Lines](https://www.investopedia.com/terms/t/trendline.asp)
- [Support and Resistance](https://www.investopedia.com/terms/s/supportandresistance.asp)
- [Chart Patterns](https://www.investopedia.com/terms/c/chartpattern.asp)
- [Elliott Wave Theory](https://www.investopedia.com/terms/e/elliottwavetheory.asp)
- [Ichimoku Cloud](https://www.investopedia.com/terms/i/ichimoku-cloud.asp)
- [Volume Weighted Average Price (VWAP)](https://www.investopedia.com/terms/v/vwap.asp)
- [Average True Range (ATR)](https://www.investopedia.com/terms/a/atr.asp)
- [Parabolic SAR](https://www.investopedia.com/terms/p/parabolicsar.asp)
- [Stochastic Oscillator](https://www.investopedia.com/terms/s/stochasticoscillator.asp)
- [Donchian Channels](https://www.investopedia.com/terms/d/donchian-channels.asp)
- [Keltner Channels](https://www.investopedia.com/terms/k/keltnerchannels.asp)
- [Haiken Ashi](https://www.investopedia.com/terms/h/haikenashi.asp)
- [Renko Charts](https://www.investopedia.com/terms/r/renkochart.asp)
- [Heikin Ashi Smoothed](https://www.tradingview.com/script/2y4qWvX7/)
- [VWAP Bands](https://www.tradingview.com/script/fL44mQ0g/)
- [Supertrend Indicator](https://www.tradingview.com/script/0GqjWj6R/)
Main Page Help:Contents Manual:Configuration settings Extensions Skins Abuse Filtering Localization Configuration Formats User rights management Database
Start Trading Now
Sign up at IQ Option (Minimum deposit $10) Open an account at Pocket Option (Minimum deposit $5)
Join Our Community
Subscribe to our Telegram channel @strategybin to receive: ✓ Daily trading signals ✓ Exclusive strategy analysis ✓ Market trend alerts ✓ Educational materials for beginners