Correct server setup for Wordpress

Hello folks,

I need your experience to setup the best environment for my Wordpress installation in regard to reliability and security. Recently we get 502 errors so that we need to reset the droplets to get back the website.


  • Currently, we have only 4 admins without real visitors working on Wordpress to prepare the website
  • After checking the traffic, I realized different IPs requesting non existing URLs which leads them to 404

Current Setup:

  • 1GB Memory, 1vCPU, 25GB SDD (5 Dollar package)
  • No additional services activated such as Volumes, Backups etc.
  • Firewall deactivated
  • Ubuntu 18.04
  • php 7.2.10, MySQL 5.7.24
  • /etc/php/7.2/apache2/php.ini I set the memory limit to 512M
  • In Wordpress config I set memory limit to 512M
  • php Post max size 16MP
  • php time limit 60sec
  • Heavy plugins installed: Woocommerce, Dokan, Yoast, WP Rocket, KingComposer and Redux
  • Free version of Malcare Wordpress plugin to make use of their firewall (don’t know if it really works)

Can you help me out to have a proper setup, please? Based on the statistic graph the memory is often at 90% (apache2 up to 90%, mysqld up to 20/30%) although we don’t have high traffic and visitors. I’m also not sure what memory limit to set within the php.ini file (1Gb because I have 1GB memory server?). I hope you realize that I am a beginner, so every suggestion and tutorial is appreciated.

Thank you.


One more info: Memcached is also installed but I am not sure if I am using it properly. I just added

$memcached_servers = array(
    'default' => array(

to wp–config.php

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.


Your base setup looks OK, you just need more RAM. For example having your PHP memory limit at 512M and only 1024M available means that only two memory demanding processes would exhaust all of your RAM.

I would recommend adjusting your PHP memory 256M or even 128M unless it is required by some of your plugins.

And as you have Memcache I would recommend going for at least 2 or 4 GB of RAM.

But besides that what you could do is:

  • delete any plugins that you do not need
  • once the site is ready install a good caching plugin, this would reduce the overall load on the system
  • if possible use a CDN like CloudFlare so that it could off load some of the traffic for your server

Regards, Bobby