Published: 22.08.2026
Running WordPress on your own VPS gives you speed and control that shared plans cannot match. The setup takes about an hour if you follow the steps. This guide uses the popular LEMP stack: Linux, Nginx, MariaDB or MySQL, and PHP.

Before you start
- A VPS with a current Ubuntu or Debian release and at least 1 GB of memory.
- A domain name with an A record pointing to the server IP address.
- SSH access with a regular user that can use sudo.
Step 1: Update and secure the server
Update the package lists and install updates. Enable a firewall that allows SSH, HTTP and HTTPS only. Use SSH keys and disable password login when you have checked that keys work.
Step 2: Install the web server and PHP
Install Nginx and PHP-FPM with the extensions WordPress needs, such as curl, gd, mbstring, xml, zip and the MySQL driver. Start both services and check that the default Nginx page opens at the server address.
Step 3: Install and secure the database
Install MariaDB or MySQL and run its secure installation script. Create a database and a user with a strong password that has rights only on that database. Do not allow the database to accept connections from the internet.
Step 4: Download WordPress
Download the latest release from the official site, unpack it into a folder such as /var/www/example.com and set the owner to the web server user. Copy the sample configuration file, enter the database name, user and password, and add the unique security keys that the official generator provides.
Step 5: Configure Nginx
Create a server block for your domain with the folder as the root, the index file, a location rule that passes pretty permalinks to index.php and a rule that sends PHP files to PHP-FPM. Block access to hidden files. Test the configuration and reload Nginx.
Step 6: Enable HTTPS
Use a free certificate tool for Nginx to issue and renew the certificate automatically, and let it add the redirect from HTTP to HTTPS. Check the renewal with a dry run.
Step 7: Finish in the browser
Open your domain and complete the famous five-minute installation: site title, administrator name, a strong password and an e-mail address. Then set permalinks, delete sample content and install only the plugins you need.
Step 8: Speed it up
- Enable OPcache for PHP.
- Use a page cache plugin or Nginx FastCGI cache.
- Add an object cache such as Redis if the site has many dynamic pages.
- Compress images and use a modern format such as WebP.
Step 9: Protect and back up
- Install Fail2ban to block repeated login attempts.
- Enable automatic updates for security releases.
- Schedule daily backups of files and the database to a different place and test the restore.
- Limit access to the admin area and use two-factor authentication.
Common problems
- 502 Bad Gateway: PHP-FPM is not running or the socket path in Nginx is wrong.
- Error establishing a database connection: wrong credentials or the database service is stopped.
- 404 on posts: the permalink rule is missing in the Nginx configuration.
- Cannot upload files: check folder ownership and the upload size limit.
Frequently asked questions
Is a VPS better than shared hosting for WordPress? It gives more speed and control, but you take on administration unless you buy a managed plan.
Can I use Apache instead of Nginx? Yes. The idea is the same, with different configuration files.
What if I do not want to do this myself? Choose a managed VPS or a one-click image prepared by your provider.