WordPress Local Development Environment Complete Guide
# Background
I needed a local development environment to test themes, plugins, and WordPress core updates. After hitting countless walls, I tested all the major approaches: Local by Flywheel (free, 45K+ GitHub stars), DevKinsta (from Kinsta, free but full features for Kinsta users only), manual Lnmp (most flexible but most time-consuming), and Docker (I wrote about Docker WordPress installation before, this time focusing on local dev scenarios).
This article cuts through one thing: which tool to use in which scenario.
Why Local Development Environment Matters
Editing code on a live site is suicide. A staging environment surfaces all the problems before they reach production.
Three core needs:
1. Quick site spin-up: A fresh WordPress site in 5 minutes
2. Multi-version compatibility: Test PHP 7.4/8.0/8.3 compatibility
3. Data isolation: Each project has its own database, no interference
Local by Flywheel: Free First Choice
Who Should Use It
Individual developers, students, theme developers who need quick site setup without spending money.
Core Advantages
- **One-click creation**: Click a few times, WordPress is up
- **Live Link sharing**: Generate a local URL to send to clients for preview, no Ngrok configuration needed
- **Multi-site support**: One panel manages multiple WordPress sites
- **Free**: Basic features completely free, Mac/Win/Linux cross-platform
Practical Steps
Download and install from localwp.com, then:
1. Click "+" to create a new site
2. Enter site name, select PHP version (recommend 8.2) and WordPress version
3. Click "Create", wait 3 minutes
4. Site appears in the left list, click "Admin" to enter the dashboard
Pitfalls Encountered
Pitfall 1: On macOS Big Sur and later, Local needs System Integrity Protection disabled to use Spinning Horse
Solution: Switch to "Fast CGI" mode instead of "Spinning Horse"
Pitfall 2: Site fails to start, showing "Port 443 already in use"
Cause: Other services occupying port 443 (common with Apache or VMWare)
Fix: sudo lsof -i :443 to find the process, kill it, then retry
Data
- Official site: localwp.com
- GitHub stars: 45,000+ (wpdv repository)
- Supported systems: macOS, Windows, Linux (beta)
DevKinsta: Essential for Kinsta Users
Who Should Use It
Users already using Kinsta hosting, or those who want to use high-quality WordPress hosting.
Core Advantages
- **Kinsta ecosystem**: One-click push from DevKinsta directly to Kinsta production
- **Nginx + PHP 8.3**: Production environment configuration is completely consistent
- **Free**: Free for all users (even without Kinsta)
- **Auto SSL configuration**: HTTPS ready out of the box
Practical Steps
1. Download DevKinsta (kinsta.com/devkinsta)
2. Create new site, select "WordPress" or "WordPress Multisite"
3. Choose PHP version (up to 8.3) and database engine (MySQL or MariaDB)
4. Click "Create", wait 3 minutes
5. WordPress admin URL: https://localhost:10002/
Pitfalls Encountered
Pitfall 1: After uninstall, residual MySQL process keeps port 3306 occupied
Fix: On Mac brew services stop kinsta-mysql, on Windows run as administrator sc delete KinstaMySQL
Pitfall 2: In multisite mode, subdirectory sites cannot be accessed
Cause: Nginx configuration does not support PATHINFO by default
Fix: Enable "Pretty Permalinks" in DevKinsta settings
Data
- Official site: kinsta.com/devkinsta
- Minimum hardware: 4GB RAM, 10GB disk
- PHP versions: 7.4/8.0/8.1/8.2/8.3
Manual Lnmp/Docker: The Control-Freaks' Choice
Who Should Use It
Developers with Linux ops experience who need full control over server configuration, or already using Docker for other services.
Local Docker + WordPress (My Previous Approach)
I wrote a complete Docker WordPress installation guide before (2026-04-25), so this time I'll skip basics and focus on the local dev scenario:
# docker-compose.yml (key configuration)
services:
wordpress:
image: wordpress:6.9-php8.3-fpm
ports:
- "8080:80"
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: wpuser
WORDPRESS_DB_PASSWORD: wppass
WORDPRESS_DB_NAME: wpdb
volumes:
- ./wp-data:/var/www/html
depends_on:
db:
condition: service_healthy
db:
image: mysql:8.0
environment:
MYSQL_DATABASE: wpdb
MYSQL_USER: wpuser
MYSQL_PASSWORD: wppass
volumes:
- mysql-data:/var/lib/mysql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
retries: 10
volumes:
mysql-data:
docker compose up -d
# Wait 30 seconds, then visit http://localhost:8080
Best for: Already using Docker for dev environment, need unified management with other services (n8n, PostgreSQL, etc.)
Manual Lnmp (Maximum Control)
Suits scenarios needing deep Nginx customization, PHP-FPM process counts, detailed logging:
# Ubuntu 24.04 LTS minimal install
sudo apt update && sudo apt upgrade -y
# Install Nginx
sudo apt install nginx -y
# Install PHP 8.3 FPM + common extensions
sudo apt install php8.3-fpm php8.3-mysql php8.3-curl \
php8.3-gd php8.3-mbstring php8.3-xml php8.3-zip \
php8.3-imagick php8.3-redis -y
# Install MySQL 8.0
sudo apt install mysql-server -y
# Start services
sudo systemctl start php8.3-fpm
sudo systemctl start nginx
sudo systemctl start mysql
# Create WordPress database
sudo mysql
# > CREATE DATABASE wpdb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
# > CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'wppass';
# > GRANT ALL PRIVILEGES ON wpdb.* TO 'wpuser'@'localhost';
# > FLUSH PRIVILEGES;
Nginx configuration (/etc/nginx/sites-available/wordpress):
server {
listen 80;
root /var/www/wordpress;
index index.php;
server_name localhost;
client_max_body_size 100M;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
sudo ln -s /etc/nginx/sites-available/wordpress \
/etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
# Download WordPress
cd /var/www
sudo wget https://wordpress.org/wordpress-6.9.4.tar.gz
sudo tar -xzf wordpress-6.9.4.tar.gz
sudo chown -R www-data:www-data /var/www/wordpress
Best for: Mirror of VPS production environment, local dev 100% identical to production.
Pitfalls Encountered (Manual Lnmp)
Pitfall 1: PHP 8.3 socket path changed
On Ubuntu 24.04, PHP 8.3 FPM socket path is /run/php/php8.3-fpm.sock, not the old /run/php/php7.sock
Fix: Check the socket path in /etc/nginx/snippets/fastcgi-php.conf or modify manually
Pitfall 2: MySQL 8.0's caching_sha2_password authentication
Some older WordPress plugins are incompatible with caching_sha2_password, need to switch to mysql_native_password:
ALTER USER 'wpuser'@'localhost' \
IDENTIFIED WITH mysql_native_password BY 'wppass';
Pitfall 3: Nginx 403 Forbidden
Check: Is /var/www/wordpress directory owned by www-data?
Fix: sudo chown -R www-data:www-data /var/www/wordpress
Side-by-Side Comparison
| Dimension | Local by Flywheel | DevKinsta | Manual Lnmp/Docker |
|---|---|---|---|
| Cost | Free | Free (full features for Kinsta users) | Free |
| Ease of use | ⭐⭐ (5 minutes) | ⭐⭐ (5 minutes) | ⭐⭐⭐⭐⭐ (1 hour+) |
| Multi-site support | ✅ | ✅ | ✅ (manual config) |
| PHP version switching | ✅ (UI click) | ✅ (UI click) | ❌ (needs reinstall) |
| Auto SSL config | ✅ | ✅ | ❌ (manual certbot) |
| Live Link sharing | ✅ (unique) | ❌ | ❌ |
| Production push | ❌ | ✅ (Kinsta one-click deploy) | ❌ |
| System footprint | ~500MB | ~2GB | Depends on config |
Decision Tree for Choosing
Need quick site for testing plugins/themes?
├─ Yes → Need Live Link to share with clients?
│ ├─ Yes → Local by Flywheel ✅
│ └─ No → Local by Flywheel ✅
└─ No → Using Kinsta hosting?
├─ Yes → DevKinsta ✅ (one-click to production)
└─ No → Need full control of Nginx/PHP config?
├─ Yes → Manual Lnmp ✅
└─ No → Docker ✅ (unified management with n8n etc.)
Summary
Local by Flywheel: First choice for individual developers, 5-minute setup, free, Live Link is the killer feature.
DevKinsta: Essential for Kinsta users, one-click push to production eliminates deployment headaches.
Manual Lnmp/Docker: For developers with ops experience who need complete control, or want to locally mirror their VPS production environment.
👉 立即参与:https://platform.minimaxi.com/subscribe/token-plan?code=E5yur9NOub&source=link
Related Reading
- WordPress Docker Installation Complete Guide: An Alternative to Lnmp
- WordPress HTTPS & SSL Setup: All the Let's Encrypt Traps I Hit
- n8n Self-Hosted Docker Deployment: 5 Real Problems I Hit
WordPress Development Book
If you want to master WordPress plugin and theme development, I recommend **WordPress Plugin Development** (ISBN 1803237263), which I use as a reference in my own projects.
📌 This article was AI-assisted generated and human-reviewed | TechPassive — An AI-driven content testing site focused on real tool reviews
🔗 Recommended Tools
These are carefully selected tools. Using our affiliate links supports us to keep producing quality content: