So, you’ve chosen VPS hosting for your WordPress website. Good call. You get to avoid the high costs of a dedicated server, but still reap the benefits of running a site from a private server environment.
However, as more bandwidth, storage, and overall server control become available with VPS hosting, you must remain cognizant of performance as a result.
In this post, we’re going to cover ways in which you can use WordPress VPS optimization. We’ll also include ways in which you can optimize at the server level, but the majority of the focus will be on practical optimizations you can apply within WordPress.
Tips for Mastering WordPress VPS Optimization
The choice of VPS hosting for your WordPress site means you take things like security and performance seriously. But how do you make sure you get the most out of your investment in a virtual private server? You optimize your site’s functionality so you don’t max out on memory or storage, of course.
Here’s what you can do:
1. Choose the Right Bandwidth and Storage
If you haven’t yet purchased your VPS plan, find one with the bandwidth and storage you believe your site will need. If you’re not sure what that is just yet, make sure you work with a hosting company that gives you scalable options.
Here are some of WP Buff’s hosting friends. You’ll find a reliable solution from this pack:
✅ Perfect for WordPress beginners
✅ Works for smaller budgets
✅ Free migration, 24/7 support, SSL and CDN
💰 Starting at $3.95/mo
SiteGround is one of our favorite hosting providers as far as shared hosting goes. Web hosting is their craft. The latest speed technologies are their passion. Unique security solutions are their specialty. Amazing technical support is their pride. Nuff said!
✅ Perfect for websites that need special attention
✅ Like having an in-house server technician
✅ Free migration, SSL and WordPress updates
💰 Starting at $20/mo
If you're looking for hassle-free WordPress hosting for freelancers and web professionals, Anchor Hosting is for you. Austin's white-glove service is for anybody looking to work with a small, intimate team that can take care of all your hosting needs.
💰 Starting at $25/mo
With award winning speed and an expert WordPress support team, Pressable Hosting is a great choice for agencies and developers. The company is owned by Automattic, so you know they do great work. Pressable is suited to website owners, freelancers and WordPress Agencies and every plan supports staging sites for testing.
2. Use Servers Optimized for Performance
Another consideration to keep in mind with a VPS plan is to find one that already implements performance-saving measures on its servers. So, you’ll want to look for:
- MySQL 5.6 or higher
- PHP 7 or higher
Start with a strong WordPress VPS optimization base, so your WordPress site has the best chance to succeed.
3. Update All Your Software
Typically, WordPress security guides will tell you to maintain regular updates of the core, plugins, and theme. However, if we’re looking at WordPress VPS optimization, you have to look beyond what’s inside WordPress.
In addition to updating WordPress software, make sure your PHP and MySQL instances are running on the latest versions. Then, devise a schedule to ensure you regularly check in on and keep all your software up-to-date.
4. Expand Your Memory Limits
There may come a time when your VPS--no matter how abundantly roomy it may seem in terms of memory--times out. It could be due to unusually high activity on your WordPress site or perhaps you’re trying to upload something that requires the server to work overtime. If any of those preset limits are exceeded, you could find yourself in hot water.💡Rather than wait for your server to time out on you, it might be a good idea to expand the limits of how it handles memory now. #WordPress Click To Tweet
In your wp-config.php file, locate this line:
/* That's all, stop editing! Happy blogging. */
Directly above it, add this line (if it doesn’t already exist):
define('WP_MEMORY_LIMIT', '[enter the memory limit]');
Where it says “[enter the memory limit]”, you could add 128M, 256M, or 512M. It ultimately depends on how much memory you need to aptly handle the additional workload.
5. Implement Server-Targeted Caching
When it comes to implementing a caching process for WordPress, we have you covered with the 110% Guide to Server and Browser Cache. That said, there are a few other kinds of caching we should talk about in terms of getting a handle on how to go about WordPress VPS optimization.
This is a caching system that directly affects the memory your VPS has to work with. To use it, you must manually install it on your server. You can check Github for instructions on how to do this for your respective server. Once configured, Memcached will optimize how database requests are cached, greatly improving your WordPress VPS optimization memory and performance in the process.
Varnish caching is a software (not unlike an SSL certificate) which is installed in front of HTTPS. It then works as a caching HTTP reverse proxy, which is known to greatly speed up the way HTTP requests are handled by servers and, as a result, optimizes performance site-wide.
This type of caching engine works specifically on websites running on PHP. As the PHP OPcache manual explains:
“OPcache improves PHP performance by storing precompiled script bytecode in shared memory, thereby removing the need for PHP to load and parse scripts on each request.”
This, consequently, will improve WordPress VPS optimization performance as it’s not constantly having to process the same lines of PHP code.
6. Limit Bot Indexing
Your security plugin is already doing a great job blocking serious threats to your WordPress site. However, there are others out there who may crawl your website and maximize your server’s resources, though not for nefarious reasons.
For example, search bots can put a great deal of pressure on your VPS. If you find that these little critters are getting out of control and messing with how well your server performs, then you can use robots.txt to get them in line. (Yes, you can use robots.txt to discourage search engine indexing, too, but you can also use it for limiting how frequently someone hits your server.)
In the robots.txt file at the root (if you don’t have one, create it), add the following code:
Crawl-Delay: [number of seconds]
Replace “[number of seconds]” with how long you want users to wait before they can issue another HTTPS request. A good place to start is at 3600 seconds (or one hour). This will then keep persistent bots at bay.
7. Stop Hotlinking
Image hotlinking is what happens when someone leeches off of your website and server to host their images. It works like this:
- You have a great-looking image uploaded to your WordPress site.
- Someone wants to use that image for their own website.
- Instead of screenshot or save a copy of the image to their machine, they display the image on their site by the URL for that image (that’s still on your server).
If this were to happen on a website with high enough traffic, it could do serious harm to your server.
There are a number of ways to disable hotlinking. First, start with your web host or CDN. They should include hotlink protection. cPanel, specifically, offers a free hotlinking solution:
If this isn’t available, there are WordPress plugins you can use instead. For instance, All In One WP Security & Firewall includes hotlink protection, which may be a convenient choice if they’re your security plugin provider already. You could also look for a plugin that solely handles hotlink protection or the disabling of right-clicks for general content scraping security.
This is not an exhaustive list, by any means. But that’s because you already know how to boost speed for WordPress VPS optimization.
Since we’re focusing specifically on how to master WordPress VPS optimization, we focused on tips based on the most common ways in which your high-performance server is drained of memory. The tips above will fully round out your performance optimization plan when your site resides on VPS hosting. If you're interested in pursuing WordPress VPS optimization, don't be afraid to reach out to us.
Want to give your feedback or join the conversation? Add your comments 🐦 on Twitter.
Brenda Barron is the blog editor for the WP Buffs WordPress blog and a freelance writer from southern California. When not working, she’s spending time with her family, homeschooling her kids, knitting, and getting outdoors. Find out more about her at Digital Inkwell. If you want some freebies, check out our free speed and security ebooks, webinars for WordPress professionals, WordPress blog or WordPress podcast all about building monthly recurring revenue.