Correct server setup for Wordpress

January 10, 2019 459 views
WordPress Ubuntu 18.04

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.

Situation:

  • 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.

1 comment
  • 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(
            '127.0.0.1:11211',
            '10.10.10.30:11211'
        )
    );
    

    to wp–config.php

1 Answer

Hello,

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

Have another answer? Share your knowledge.