Optimizing WackoWiki for Nginx
Nginx is an excellent, lightweight, and high-performance choice for running WackoWiki locally or in production. It excels in static file serving and concurrency compared to Apache.
1. Enable Clean URLs (Rewrite Mode)
WackoWiki supports pretty URLs via its internal router. In the installer or config.php, set:
php 'rewrite_mode' => true,
Recommended Nginx Rewrite Configuration
Add this inside your server {} block (tested and recommended from WackoWiki docs):
nginx
server {
listen 80;
listen 443 ssl;
server_name wackowiki.test; # or localhost, your custom domain
root /path/to/your/wackowiki; # Point to the folder containing index.php
index index.php index.html;
# Security: Deny access to sensitive files
location ~* /\.(ht|git|svn|log|env|bak|config)$ {
deny all;
}
# Static files - serve directly with caching
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|webp|woff2?|ttf|eot)$ {
expires 30d;
add_header Cache-Control "public";
try_files $uri =404;
}
# PHP handling via FastCGI (PHP-FPM)
location ~ \.php$ {
fastcgi_pass unix:/run/php/php8.3-fpm.sock; # Adjust version/socket path
# fastcgi_pass 127.0.0.1:9000; # TCP alternative
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
# Recommended timeouts and buffers for better performance
fastcgi_read_timeout 120;
fastcgi_send_timeout 120;
fastcgi_connect_timeout 60;
}
# Main rewrite rules for WackoWiki
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php) {
rewrite (.*) $1/index.php break;
}
if (!-f $request_filename) {
rewrite (.*) /index.php break;
}
# Fallback
location / {
try_files $uri $uri/ /index.php?$args;
}
}
Note: The if conditions are the official recommendation from WackoWiki for handling the router and admin panel correctly.
2. FlyEnv-Specific Setup (Nginx)
In FlyEnv:
- Install Nginx module.
- Install desired PHP version (8.1–8.4 recommended) + PHP-FPM.
- Create a new Host:
- Host name:
wackowiki.test(orlocalhost) - Document root: path to your WackoWiki files
- Enable SSL + Auto Certificates
- Host name:
FlyEnv usually generates a basic config. Replace or edit the site’s Nginx config file (FlyEnv shows the path) with the optimized block above.
3. Performance Optimizations
| Area | Recommendation | Benefit |
|---|---|---|
| Gzip | gzip on; gzip_types text/plain text/css application/javascript; |
Smaller responses |
| Static Caching | Add expires + Cache-Control for images/CSS/JS |
Faster repeat visits |
| PHP-FPM | Use pm = dynamic or ondemand; tune pm.max_children |
Better resource usage |
| Open File Cache | open_file_cache max=10000 inactive=30s; |
Reduced disk I/O |
| Client Limits | client_max_body_size 20m; (match upload_max_filesize) |
Larger file uploads |
| Buffering | fastcgi_buffering on; + reasonable buffer sizes |
Smoother PHP responses |
Example additions to http {} or server {}:
nginx
http {
gzip on;
gzip_min_length 1024;
gzip_types text/plain text/css text/javascript application/json application/javascript;
open_file_cache max=5000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
}
4. Security Hardening (Local + Production)
- Deny access to
.htaccess,.git, config backups. - Use HTTPS (FlyEnv auto-SSL makes this easy).
- Set proper file permissions:
config.phpshould be644, directories755. - Limit PHP exposure:
expose_php = Offinphp.ini.
5. Troubleshooting Common Issues
- Admin panel / pages broken after enabling rewrite → Use the exact rewrite rules above.
- White page / 500 errors → Check PHP-FPM socket path and error logs (FlyEnv shows them easily).
- CSS/JS not loading → Verify rewrite rules and that static location block is before the PHP one.
- Installer stuck → Temporarily disable rewrite_mode, finish install, then re-enable.
Resources
- Official WackoWiki ModRewrite page (includes Nginx section)
- FlyEnv documentation for Nginx hosts
- Nginx beginner’s guide + rewrite module docs
Nginx + PHP-FPM + WackoWiki is a very efficient and snappy combination. Once configured, it typically feels faster than Apache, especially for serving wiki pages and attachments. Test thoroughly with rewrite mode enabled.