Configuring Nginx with MediaWiki
---
- Configuring Nginx with MediaWiki: A Comprehensive Guide
This document details the configuration of a server environment utilizing Nginx as a reverse proxy in front of MediaWiki, version 1.40. It covers hardware specifications, performance characteristics, recommended use cases, comparison with alternative setups, and essential maintenance considerations. This is intended for experienced system administrators and server hardware engineers. This documentation assumes a Linux-based operating system, specifically Ubuntu Server 22.04 LTS, but the concepts are broadly applicable.
1. Hardware Specifications
The performance of a MediaWiki installation, especially when coupled with Nginx, is heavily reliant on the underlying hardware. The following specifications are recommended for various scales of deployment. These are divided into Small, Medium, and Large tiers. All tiers assume the use of Solid State Drives (SSDs) for optimal performance. HDD-based storage will significantly degrade performance, especially with frequent database writes. Consider using NVMe SSDs for the database server in higher tiers.
1.1 Small Tier (Up to 50 Concurrent Users)
This tier is suitable for small wikis with limited traffic, personal projects, or development environments.
Component | Specification |
---|---|
CPU | Intel Xeon E-2324G (6 Cores, 3.9 GHz Turbo Boost) or AMD Ryzen 5 5600G (6 Cores, 4.4 GHz Turbo Boost) |
RAM | 8 GB DDR4 3200MHz ECC RAM |
Storage (OS & Webroot) | 256 GB NVMe SSD |
Storage (MediaWiki Files) | 500 GB SATA SSD |
Network Interface | 1 Gbps Ethernet |
Power Supply | 350W 80+ Bronze |
1.2 Medium Tier (50 - 500 Concurrent Users)
This tier is designed for moderately sized wikis with a significant user base. Redundancy should be considered at this tier, particularly in power and networking.
Component | Specification |
---|---|
CPU | Intel Xeon E-2388G (8 Cores, 5.1 GHz Turbo Boost) or AMD Ryzen 7 5800X (8 Cores, 4.7 GHz Turbo Boost) |
RAM | 16 GB DDR4 3200MHz ECC RAM |
Storage (OS & Webroot) | 512 GB NVMe SSD |
Storage (MediaWiki Files) | 1 TB NVMe SSD |
Network Interface | 10 Gbps Ethernet (or dual 1 Gbps with link aggregation) |
Power Supply | 550W 80+ Gold |
1.3 Large Tier (500+ Concurrent Users)
This tier is for large, high-traffic wikis requiring maximum performance and scalability. Database server should be on separate hardware. See Database Server Architecture for details.
Component | Specification |
---|---|
CPU | Dual Intel Xeon Silver 4310 (12 Cores, 2.1 GHz) or Dual AMD EPYC 7313 (16 Cores, 3.0 GHz) |
RAM | 32 GB DDR4 3200MHz ECC Registered RAM (per server) |
Storage (OS & Webroot - Web Server) | 1 TB NVMe SSD |
Storage (MediaWiki Files - File Server) | 2 TB NVMe SSD (RAID 1 or RAID 10) |
Storage (Database - DB Server) | 4 TB NVMe SSD (RAID 10) |
Network Interface | 10 Gbps Ethernet (or higher, with redundancy) |
Power Supply | 850W 80+ Platinum (Redundant Power Supplies recommended) |
1.4 Networking Considerations
Regardless of tier, a stable and low-latency network connection is crucial. Consider using a Content Delivery Network (CDN) for static assets (images, CSS, JavaScript) to reduce load on the server and improve response times for geographically dispersed users. See CDN Integration with MediaWiki for more information.
2. Performance Characteristics
Performance will vary depending on the specific hardware configuration, MediaWiki extensions installed, and the complexity of wiki pages. The following benchmarks were conducted using ApacheBench (ab) and represent approximate results. These are *not* guarantees, but indicative of expected performance. All tests were conducted with 100 concurrent users and 1000 requests, simulating typical user activity. The database used was MariaDB 10.6.
2.1 Small Tier Performance
- Average Response Time: 0.8 - 1.5 seconds
- Requests per Second: 50 - 80
- Error Rate: < 1%
- CPU Usage (Peak): 60-80%
- Memory Usage (Peak): 6 GB
2.2 Medium Tier Performance
- Average Response Time: 0.3 - 0.7 seconds
- Requests per Second: 150 - 250
- Error Rate: < 0.5%
- CPU Usage (Peak): 70-90%
- Memory Usage (Peak): 12 GB
2.3 Large Tier Performance
- Average Response Time: 0.1 - 0.3 seconds
- Requests per Second: 400 - 600+
- Error Rate: < 0.1%
- CPU Usage (Peak): 80-95%
- Memory Usage (Peak): 25 GB+
These benchmarks assume a reasonably optimized MediaWiki installation with caching enabled (see MediaWiki Caching Strategies). The performance of complex pages with numerous extensions will be lower. Regular performance monitoring using tools like `top`, `htop`, and `vmstat` is essential for identifying bottlenecks. See Server Monitoring and Alerting for details on setting up monitoring.
3. Recommended Use Cases
This configuration (Nginx + MediaWiki) is ideal for the following scenarios:
- **Public-facing wikis:** The reverse proxy capability of Nginx provides enhanced security and load balancing.
- **Internal knowledge bases:** A centralized wiki can improve knowledge sharing within an organization.
- **Documentation platforms:** MediaWiki is well-suited for creating and managing comprehensive documentation.
- **Community portals:** Wikis facilitate collaboration and content creation by a community of users.
- **Educational resources:** Creating and sharing educational materials in a structured format.
- **High-traffic websites:** The combination of Nginx's efficiency and MediaWiki's robust content management capabilities can handle significant traffic.
4. Comparison with Similar Configurations
The Nginx + MediaWiki configuration is often compared to other web server/wiki combinations. Here's a comparison:
Configuration | Advantages | Disadvantages | Use Cases |
---|---|---|---|
Apache + MediaWiki | Widely documented, easy to configure initially. | Higher resource consumption, slower performance under load compared to Nginx. | Smaller wikis with low traffic, simpler setups. |
Nginx + MediaWiki (This Configuration) | High performance, efficient resource utilization, excellent for static content serving, built-in load balancing. | More complex configuration than Apache. | Medium to large wikis with moderate to high traffic, demanding performance requirements. |
LiteSpeed + MediaWiki | Potentially very high performance with LiteSpeed Cache. | Requires a paid license. Less widely used than Nginx or Apache. | High-traffic wikis where maximizing performance is critical and a license cost is acceptable. |
Varnish Cache + Nginx + MediaWiki | Highest possible performance through aggressive caching. | Most complex configuration, requires significant tuning. | Extremely high-traffic wikis with a large amount of static content. See Varnish Cache Configuration. |
Nginx excels at serving static content and handling concurrent connections, making it a natural fit for a reverse proxy in front of MediaWiki. Apache, while easier to set up initially, typically consumes more resources and performs less efficiently under load. LiteSpeed offers competitive performance but requires a paid license. Adding Varnish Cache adds another layer of complexity but can significantly improve performance for heavily cached content.
5. Maintenance Considerations
Maintaining a server running Nginx and MediaWiki involves several key considerations:
5.1 Cooling
Proper cooling is essential, particularly for the Large Tier configurations. Ensure adequate airflow within the server room or rack. Consider using liquid cooling for high-density deployments. Monitor CPU temperatures regularly using tools like `sensors`.
5.2 Power Requirements
The power requirements vary depending on the hardware tier. Ensure the power supply has sufficient capacity to handle the peak load. For the Large Tier, redundant power supplies are strongly recommended. Implement an Uninterruptible Power Supply (UPS) to protect against power outages. See Power Management and Redundancy.
5.3 Security Updates
Regularly apply security updates to the operating system, Nginx, MariaDB, PHP, and MediaWiki itself. Automate this process where possible using tools like `apt update && apt upgrade`. See Security Hardening for MediaWiki Servers.
5.4 Backups
Implement a comprehensive backup strategy for the entire server, including the operating system, webroot, MediaWiki files, and database. Test the backup and restore process regularly. Consider using offsite backups for disaster recovery. See Backup and Disaster Recovery.
5.5 Monitoring
Continuously monitor server performance metrics (CPU usage, memory usage, disk I/O, network traffic) to identify potential bottlenecks and issues. Set up alerts to notify administrators of critical events. See Server Monitoring and Alerting.
5.6 Log Rotation
Configure log rotation for Nginx, PHP, and MariaDB to prevent log files from consuming excessive disk space. Analyze logs regularly to identify security threats and performance issues. See Log Management and Analysis.
5.7 Database Maintenance
Regularly optimize the MariaDB database using tools like `OPTIMIZE TABLE` and `ANALYZE TABLE`. Implement a regular database backup schedule. See Database Maintenance and Optimization.
---
Database Server Architecture
CDN Integration with MediaWiki
MediaWiki Caching Strategies
Server Monitoring and Alerting
Varnish Cache Configuration
Security Hardening for MediaWiki Servers
Backup and Disaster Recovery
Log Management and Analysis
Database Maintenance and Optimization
Nginx Configuration Best Practices
PHP Configuration for MediaWiki
MariaDB Configuration for MediaWiki
MediaWiki Extension Management
Troubleshooting Common MediaWiki Issues
Load Balancing Strategies for MediaWiki
Intel-Based Server Configurations
Configuration | Specifications | Benchmark |
---|---|---|
Core i7-6700K/7700 Server | 64 GB DDR4, NVMe SSD 2 x 512 GB | CPU Benchmark: 8046 |
Core i7-8700 Server | 64 GB DDR4, NVMe SSD 2x1 TB | CPU Benchmark: 13124 |
Core i9-9900K Server | 128 GB DDR4, NVMe SSD 2 x 1 TB | CPU Benchmark: 49969 |
Core i9-13900 Server (64GB) | 64 GB RAM, 2x2 TB NVMe SSD | |
Core i9-13900 Server (128GB) | 128 GB RAM, 2x2 TB NVMe SSD | |
Core i5-13500 Server (64GB) | 64 GB RAM, 2x500 GB NVMe SSD | |
Core i5-13500 Server (128GB) | 128 GB RAM, 2x500 GB NVMe SSD | |
Core i5-13500 Workstation | 64 GB DDR5 RAM, 2 NVMe SSD, NVIDIA RTX 4000 |
AMD-Based Server Configurations
Configuration | Specifications | Benchmark |
---|---|---|
Ryzen 5 3600 Server | 64 GB RAM, 2x480 GB NVMe | CPU Benchmark: 17849 |
Ryzen 7 7700 Server | 64 GB DDR5 RAM, 2x1 TB NVMe | CPU Benchmark: 35224 |
Ryzen 9 5950X Server | 128 GB RAM, 2x4 TB NVMe | CPU Benchmark: 46045 |
Ryzen 9 7950X Server | 128 GB DDR5 ECC, 2x2 TB NVMe | CPU Benchmark: 63561 |
EPYC 7502P Server (128GB/1TB) | 128 GB RAM, 1 TB NVMe | CPU Benchmark: 48021 |
EPYC 7502P Server (128GB/2TB) | 128 GB RAM, 2 TB NVMe | CPU Benchmark: 48021 |
EPYC 7502P Server (128GB/4TB) | 128 GB RAM, 2x2 TB NVMe | CPU Benchmark: 48021 |
EPYC 7502P Server (256GB/1TB) | 256 GB RAM, 1 TB NVMe | CPU Benchmark: 48021 |
EPYC 7502P Server (256GB/4TB) | 256 GB RAM, 2x2 TB NVMe | CPU Benchmark: 48021 |
EPYC 9454P Server | 256 GB RAM, 2x2 TB NVMe |
Order Your Dedicated Server
Configure and order your ideal server configuration
Need Assistance?
- Telegram: @powervps Servers at a discounted price
⚠️ *Note: All benchmark scores are approximate and may vary based on configuration. Server availability subject to stock.* ⚠️