How to Deploy WordPress on Ubuntu VPS
- Active Linux VPSGrid service (1 GB+ RAM recommended for production WordPress)
- SSH access — How to Connect via SSH to Your VPSGrid Linux VPS
- Domain A record to VPS IP (recommended) — Point Your Domain to a VPSGrid VPS
- Updated system packages — Updating Ubuntu, Debian, AlmaLinux and Rocky Linux on VPSGrid
Deploy WordPress on Ubuntu with a LEMP stack (Nginx, MariaDB, PHP-FPM): create a database, download WordPress, configure Nginx, complete the web installer, then harden with firewall rules and backups.
Overview
WordPress on VPSGrid runs inside your unmanaged Linux guest. You install and maintain the web stack (Nginx, PHP, MariaDB), unlike shared hosting where the provider manages Apache and PHP versions globally.
This guide installs WordPress using the LEMP stack: Linux, Nginx, MariaDB (MySQL-compatible), and PHP-FPM. The steps target Ubuntu/Debian; adapt package names on AlmaLinux/Rocky if needed.
Install Nginx, MariaDB, and PHP (LEMP)
Update system packages
sudo apt-get update && sudo apt-get upgrade -yInstall Nginx and MariaDB
sudo apt-get install -y nginx mariadb-server mariadb-clientRun mariadb-secure-installation (MariaDB 10.6+) or mysql_secure_installation on older installs to set root password and remove test databases before production use.
Fresh MariaDB on Ubuntu/Debian often allows sudo mysql as root via unix_socket authentication — no password required until you run secure installation.
Install PHP and extensions
WordPress requires mysqli, curl, gd, xml, mbstring, and zip extensions:
sudo apt-get install -y php-fpm php-mysql php-curl php-gd php-xml php-mbstring php-zip php-intlCreate the WordPress database
sudo mysql -e "CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
sudo mysql -e "CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'STRONG_RANDOM_PASSWORD';"
sudo mysql -e "GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';"
sudo mysql -e "FLUSH PRIVILEGES;"Replace STRONG_RANDOM_PASSWORD with a unique credential. Never commit database passwords to public git repositories.
Download and configure WordPress
Download WordPress
cd /var/www\nsudo mkdir -p wordpress\ncd wordpress\nsudo curl -O https://wordpress.org/latest.tar.gz\nsudo tar -xzf latest.tar.gz --strip-components=1\nsudo rm latest.tar.gzConfigure wp-config.php
sudo cp wp-config-sample.php wp-config.php\nsudo nano wp-config.phpSet DB_NAME, DB_USER, DB_PASSWORD, and generate unique authentication salts from WordPress secret key API.
Set file permissions
sudo chown -R www-data:www-data /var/www/wordpress\nsudo find /var/www/wordpress -type d -exec chmod 755 {} \;\nsudo find /var/www/wordpress -type f -exec chmod 644 {} \;Configure Nginx for WordPress
Detect PHP-FPM socket
Ubuntu 24.04 may ship PHP 8.3; Debian 12 often uses 8.2. List available sockets before editing Nginx:
ls /run/php/php*-fpm.sockUse the socket path from the command output in fastcgi_pass below (example shows PHP 8.3). On Debian, install nginx-full if snippets/fastcgi-php.conf is missing from the base nginx package.
Create server block (replace example.com with your domain):
server {\n listen 80;\n server_name example.com www.example.com;\n root /var/www/wordpress;\n index index.php index.html;\n\n location / {\n try_files $uri $uri/ /index.php?$args;\n }\n\n location ~ \.php$ {\n include snippets/fastcgi-php.conf;\n fastcgi_pass unix:/run/php/php8.3-fpm.sock; # match ls output above\n }\n\n location ~* /(?:uploads|files)/.*\.php$ {\n deny all;\n }\n}sudo ln -s /etc/nginx/sites-available/wordpress /etc/nginx/sites-enabled/\nsudo nginx -t\nsudo systemctl reload nginxComplete the WordPress web installer
Browse to http://YOUR_DOMAIN or http://YOUR_PRIMARY_IP and complete the installation wizard (site title, admin user, password). Use a strong admin password and avoid username admin.
Harden your new WordPress site
Apply OS updates, configure UFW (Complete UFW Firewall Guide for VPSGrid Linux VPS), add fail2ban (Fail2ban Setup on VPSGrid Linux VPS), define a backup plan (VPS Backup Strategy (3-2-1) for VPSGrid Customers), migrate to SSH keys (SSH Key Authentication Setup), and follow Basic Linux VPS Security Checklist. Disable file editing in wp-config if not required: add define('DISALLOW_FILE_EDIT', true); to wp-config.php.
Troubleshooting WordPress installation errors
| Symptom | Cause | Fix |
|---|---|---|
| 502 Bad Gateway | PHP-FPM socket mismatch | Verify fastcgi_pass socket path matches php -v FPM pool |
| Error establishing database connection | Wrong wp-config credentials | Test login: mysql -u wpuser -p wordpress |
| 404 on permalinks | try_files not configured | Confirm Nginx location block; flush permalinks in WP admin |
| White screen | PHP fatal error | Check /var/log/nginx/error.log and PHP-FPM log |
If the VPS is unreachable entirely, review VPS Not Accessible — Troubleshooting Guide and use Using the VPSGrid NoVNC Console for console recovery.
Going live
After HTTP works, point production DNS and add HTTPS. Browse Linux VPS plans if you need a separate staging server for plugin testing.
PHP-FPM tuning basics
Default PHP-FPM pools may allow excessive concurrent workers for small VPS plans. Edit /etc/php/8.x/fpm/pool.d/www.conf — adjust pm.max_children based on available RAM (rough guide: 50–80 MB per worker for typical WordPress). Reload PHP-FPM after changes.
Object caching (overview)
Redis object caches reduce database load on busy sites. Installing Redis adds memory overhead — size VPS accordingly at vpsgrid.net checkout. WooCommerce stores benefit but require careful cache invalidation during checkout flows.
Search engine visibility
Discourage search indexing of staging subdomains via robots.txt or HTTP authentication. Production DNS should point only when the site is ready — use Checking DNS Propagation for Your VPSGrid Domain when validating record changes.
Database charset
utf8mb4 supports emoji and full Unicode in post content — verify collation matches during manual imports from older hosts.
Plugin and theme hygiene
Remove unused plugins and themes — they expand attack surface even when deactivated. Apply updates during maintenance windows and verify backups before major WordPress core upgrades.
wp-cli maintenance
After installing WP-CLI, automate plugin updates and database search-replace during migrations. WP-CLI complements but does not replace understanding LEMP components on unmanaged hosting.
Nginx caching (overview)
FastCGI cache can accelerate anonymous traffic but requires careful exclusion of logged-in users and WooCommerce cart sessions.
Staging subdomain
Use staging.example.com pointed to a clone VPS or subdirectory before applying plugin updates on production.
Email deliverability
WordPress mail() often fails on VPS without SMTP relay — plan SMTP plugin or external provider; outbound port 25 remains restricted per VPSGrid policy.
Permalink structure
Choose SEO-friendly permalinks post-install and confirm Nginx try_files routing serves pretty URLs without 404 loops.
Admin URL hardening
Restrict /wp-admin by IP in Nginx during staging phases — remove overly broad rules before launch unless maintained intentionally.
Frequently Asked Questions
Which VPSGrid plan do I need for WordPress?
Light blogs run on entry Linux VPS tiers; WooCommerce and high traffic need more RAM and CPU. Compare current plans at vpsgrid.net checkout rather than relying on third-party sizing guesses.
Can I install WordPress on AlmaLinux or Rocky Linux?
Yes — use dnf instead of apt and adjust PHP-FPM package names. Ubuntu and Debian remain the most common paths in community tutorials.
Should I use WP-CLI instead of manual install?
WP-CLI speeds repetitive tasks after the LEMP stack exists. This guide uses manual steps so you understand each component on unmanaged VPS hosting.
How do I enable HTTPS for WordPress on VPSGrid?
Point your domain with Point Your Domain to a VPSGrid VPS, then obtain Let's Encrypt certificates using the Batch 3 SSL guide after HTTP works on port 80.
Related Articles
Need more resources?
Looking for a VPS optimized for WordPress and LEMP workloads? Explore Linux VPS plans at vpsgrid.net.
Need migration assistance? Open a support ticket with your service ID and steps already tried.
Need More Help?
Search this knowledgebase for related guides. If the issue persists, open a ticket at billing.vpsgrid.net with your service ID, primary IP, and steps already tried. See What Information to Include in a Support Request and Security Responsibilities on Unmanaged VPS for scope and required details.
¿Le ha resultado útil esta respuesta?