What you are building
A production WordPress server usually includes:
- A web server (Nginx or Apache)
- PHP-FPM with a supported PHP version
- MariaDB or MySQL
- TLS certificates with auto-renewal
- Firewall and failed-login protections
- Automated off-server backups
- Basic monitoring and disk alerts
Step 1: Choose the base and access model
- Create the VPS in a region close to your visitors.
- Prefer Ubuntu LTS or another long-support distro your team already knows.
- Disable password root login. Use SSH keys only.
- Create a sudo user for day-to-day work.
- Record the provider’s recovery or console access path before you tighten the firewall.
Step 2: Update and harden the OS
- Apply system updates immediately, then reboot if the kernel changed.
- Enable automatic security updates or a scheduled patch window you actually run.
- Configure a firewall: allow SSH, HTTP, and HTTPS only unless you need more ports.
- Install fail2ban or equivalent and protect SSH.
- Set the timezone and NTP so logs and cron match reality.
Step 3: Install the WordPress stack
You can use a control panel or a lean CLI stack. Either way, verify the following:
- Web server serving a temporary hostname or IP test page
- PHP-FPM connected to the web server with
phpinfo()then removed - Database server listening on localhost only
- A dedicated database and user for WordPress with least privilege
Recommended PHP extensions for most modern WordPress sites include mysqli, curl, xml, mbstring, zip, gd or imagick, and intl.
Step 4: Create the site files and permissions
- Create a web root such as
/var/www/example.com/public. - Download WordPress core into that directory or deploy from your own repo.
- Set ownership to the PHP/web user your stack expects.
- Use directory permissions around
755and file permissions around644. - Keep
wp-config.phprestrictive and never world-writable.
For permission repairs later, see how to fix WordPress file permissions.
Step 5: Configure HTTPS before launch
- Point a staging hostname or wait for DNS if you are launching a brand-new domain.
- Issue certificates with Let’s Encrypt or your provider’s ACME tool.
- Force HTTPS redirects only after the certificate is valid.
- Test renewal with a dry run so certificate expiry does not become an outage.
If padlock warnings appear after go-live, use our SSL error how-to and mixed content guide.
Step 6: Hardening WordPress itself
- Set unique table prefix and strong salts in
wp-config.php. - Disallow file editing in admin with
DISALLOW_FILE_EDIT. - Limit XML-RPC if you do not need it.
- Create an admin user that is not named
admin. - Put SMTP credentials in a proper mail plugin or transactional provider. Do not rely on bare
mail().
Step 7: Backups, cron, and monitoring
| System | Minimum setup | Pass/fail test |
|---|---|---|
| Backups | Nightly files + database to off-server storage | You restore a file and a DB table successfully |
| Cron | System cron hitting wp-cron.php or real cron with DISABLE_WP_CRON | Scheduled posts and WooCommerce tasks run |
| Uptime / health | External uptime check + disk/CPU alerts | You receive a test alert |
| Logs | Web, PHP, and auth logs rotated | You can find a fatal error within minutes |
Step 8: Migrate or launch content
- Copy files and import the database if migrating.
- Search-replace URLs carefully for serialized data.
- Update DNS with a lowered TTL planned days ahead.
- Flush caches and confirm forms, login, checkout, and webhooks.
- Leave the old host online briefly as a rollback path.
Full migration walkthrough: migrate WordPress to a new host. Prefer a developer-owned cutover? Request a BugShield migration.
Common setup mistakes
- Opening MySQL to the public internet
- Leaving
WP_DEBUG_DISPLAYon for visitors - No swap or no disk alerts on small VPS plans
- Only provider snapshots, never tested application restores
- Pointing production DNS before HTTPS and mail are ready
Related reading
Quick answers about setting up a WordPress server
Can a beginner set up a WordPress VPS?
It is possible, but this guide assumes basic SSH knowledge and comfort maintaining Linux. If nobody can own security updates, firewalls, backups and recovery, a managed VPS is the safer fit.
Should I use Nginx or Apache for WordPress?
Either can run WordPress well. Choose the web server your team knows how to configure and maintain, then make sure PHP-FPM, redirects, caching and logs are set up correctly.
Which firewall ports should a WordPress server expose?
Most installations only need SSH, HTTP and HTTPS open to the internet. Keep the database bound to the local server and open any extra port only when a real service requires it.
Is a provider snapshot enough to protect WordPress?
No. Keep scheduled off-server backups of the WordPress files and database as well. Test a restore so you know the data can be recovered before an emergency.
When should I point the domain at the new server?
Wait until WordPress, HTTPS, mail, backups and monitoring have been tested. Lower the DNS TTL ahead of the move, rehearse the cutover and keep the old host available briefly in case you need to roll back.