How to optimize WordPress with Ubuntu VPS

Ubuntu Virtual Private Server optimized for WordPress

Category: EC2

EC2

  • ToDo list for WPjeOS

    Any suggestions on how to improve WPjeOS and still keep this VPS relatively user-friendly?

     

    Post a message

     

    • Create a similar site documenting WPjeOS running on Google App Engine. The currently available information on the subject should be more user-friendly.
  • Why would you want to run WP-JeOS VPS server?

    Why would you want to run WP-JeOS VPS server?

    WP-JeOS VPS server is short for WorPress Just Enough Operating System Virtual Private Server. Optimized for speed, safety, performance, budget and manageability. WP-JeOS uses AWS RDS, AWS ElastiCache and CloudFlare for database, cache, speed and safety. As a result the server gets dramatically offloaded. Thereby utilizing resources better for remaining services.

    WP-JeOS VPS server uses cloud services to offload CPU and memory from Ubuntu. This means that the server will accept heavier load with less resources.

     Reasons for running WP-JeOS VPS server:

    • Customize your WP-JeOS VPS server without limits.
    • Own your infrastructure except the hardware
    • Be in 100% control of your infrastructure except the hardware
    • No hardware investments.
    • Stay updated on web server optimization and put it into production immediately.
    • DIY: Don’t wait for answers on your support tickets. When the ticket finally is answered, you are ready to post two new. Do the work on the server yourself instead!
    • DIY: Don’t spend hours and hours in chat windows. Often with a new operator on every session. The new operator needs the same explanations on the situation that you previously have given numerous other operators. Sometimes the operator won’t understand you. Sometimes the operator does not agree with you. Sometimes your provider’s policy stops you from achieving your goals. It seems like forever before the matter is solved.
    • Get a deeper understanding of how your websites work and can be tuned to perform at it’s best.
    • Compared to high-performance WordPress hosting pricing is competitive when you have many WordPress sites.
    • Easy migration and upgrading
    • Unequaled privacy. It’s only you and your hardware provider that can access your server.

    Save time and money

    • Requires petite human intervention after the initial setup. WP-JeOS should conceptually run without any human interventions the full lifecycle of Ubuntu LTS. The Long Term Support Ubuntu lives for five years.

    No strings attached

    • After five years moving to a new Ubuntu LTS should be easy and fast. We don’t recommend upgrading. Update causes downtime. Especially if somethings goes wrong. Migration requires no downtime.  Create a new AWS account and setup a new WP-JeOS. Historically AWS new features are not always upgraded in the older AWS accounts.
    • No strings attached. WP-JeOS VPS server is a concept with few dependencies. Maybe Amazon is no longer the best solution in five years. Moving WP-JeOs to the better provider should be easy and fast. Running WordPress on Google AppEngine is an interesting concept that needs more maturity. The market could be entirely different in five years. WP-JeOS VPS server won’t hold you back.

     

     

    Not running WP-JeOS VPS server because:

    • You only have a single website or a few sites running. Shared hosting will save you money and loads of time.
    • You don’t like command-line
    • You don’t like tech
    • You don’t like learning new things about how a web server works and should be optimized.
    • Your opinion: The provider is responsible for keeping everything up to speed regarding website optimization.
    • More expensive than standard and budget priced website hosting.

    Conclusion:
    Should or shouldn’t you run WP-JeOS VPS server

    • In conclusion. It boils down to your feelings and values. You can consequently accomplish your work in many ways. Because it’s your working day and your life, make the choice.
    • A  good feeling at work is a seldom overrated value. Choose the solution that suits your goals and concepts best.
    • Maybe you get frustrated by having to learn new things, face technical challenges, work in command-line and spend time on matters that is not your core work.
    • Others get frustrated by posting support tickets and chatting with support operators that are less knowledgeable than yourself.
    • Most of us appreciate the freedom, and the value in not have to depend on others to performs work that you can do yourself.
    • In doubt? You should probably run a test project. We did in 2010. This site is one of the results.
    • Best of luck to you, your company or organization. Whatever choice you finally make.

    [themedy_button url=”https://#” icon=”wrench” font_awesome_att=”” label=”TBT can configure your basic WP-JeOS VPS server for just USD 199,- $” colour=”blue” colour_custom=”” size=”large” edge=”rounded” target=”_self”]

     

    [themedy_button url=”https://#” icon=”wrench” font_awesome_att=”” label=”Find a frelancer to to configure you WP-JeOS” colour=”blue” colour_custom=”” size=”large” edge=”rounded” target=”_self”]

     

     

     

     

     

  • WooCommerce and W3C Total Cache settings

    WooCommerce extra configuration steps

    InstallingDOMDocument

    WooCommerce needs DOMDocument to create HTML emails

    sudo apt-get install php-xml

    Install Multibyte String

    To display none-English characters you should install:

    sudo apt-get install php7.0-mbstring

    W3C Total Cache additional configuration steps

    Enable 2 Apache modules

    sudo a2enmod expires
    sudo a2enmod headers
    sudo service apache2 restart

    Enable compression in php.ini

    Do not zlib.output_compression if you are using W3C Total Cache.

    sudo nano /etc/php/7.0/apache2/php.ini

    Use “Ctrl”+”W” and search for zlib.output_compression and change the value from Off to On

    zlib.output_compression = On

    The directive zlib.output_compression_level is used to adjust the compression level. Set the value between 1 and 9. Choose 1 to get the least compression or 9 to get most. The default value is six which balances compression without degrading the servers performance.

    zlib.output_compression_level = 6

    Finally, restart Apache, so the changes take effect.

    sudo service apache2 restart
  • Install GD and ImageMagick on Ubuntu 16 LTS and PHP7

    PHP GD is required on WordPress and plugins like Imsanity to resize images.

    Install GD with this command

    sudo apt-get install php7.0-gd

    Then restart Apache

    To crop images with the built-in image editor in WordPress image magick is required

    sudo apt-get install imagemagick

     

    sudo service apache2 restart
  • Set permissions Apache and user ubuntu

    Many of the things we have accomplished when configuring our VPS server is done as the user “root”. This is a obstacle to Apache webserver, WordPress and the tools we use to manage the server. We need to give Apache the required permissions to work correctly.

    We want to be able to control the server with tools like an SSH client, SFTP client, WP-CLI, and WordShell. We will need to give the VPS user “ubuntu” the required access to the files and folders that constitute WordPress.

    Short version:

    Change the permission on /var/www/ and all subfolder with the following command:

    sudo chown -R ubuntu /var/www/ && sudo chown -R www-data /var/www/ && sudo chgrp -R www-data /var/www/ && sudo find /var/www/ -type f -exec chmod 644 {} \; && sudo find /var/www/ -type d -exec chmod 755 {} \; && sudo chown www-data:www-data -R /var/www/ && sudo usermod -aG www-data ubuntu && sudo chmod -R g+w /var/www/

    Change ownership and delegate access

    To verify that the permissions are correct:

    cd /var/www/MyDomain1.com

    Then issue the command:

    sudo ls -l /var/www/MyDomain1.com

    Both the user and group should be “www-data“. If this is not the case, then here is how to correct this:

    Set the right permissions on files and folders

    The Apache web server needs permission to run WordPress.
    Change the owner of the files with this command:

    sudo chown -R www-data /var/www/MyDomain1.com

    moreover, alter the group with this command:

    sudo chgrp -R www-data /var/www/MyDomain1.com

    Set all files to 644 with this command

    sudo find /var/www/MyDomain1.com/ -type f -exec chmod 644 {} \;

    Set all folders to 755 with this:

    sudo find /var/www/MyDomain1.com/ -type d -exec chmod 755 {} \;

    The WordPress configuration file wp-config.php needs extra protection with the 660 rights

    sudo chmod 660 /var/www/MyDomain1.com/wp-config.php

    Apache needs access both as a group and a user.

    sudo chown www-data:www-data -R /var/www/MyDomain1.com/

    Get access with SFTP, WP-CLI, and WordShell

    The user ubuntu needs to access the websites directory tree and home folder with the admin tools SFTP, SSH, WP-CLI, and WordShell.
    This command adds the user ubuntu to the group www-data:

    sudo usermod -aG www-data ubuntu

    and

    sudo chmod -R g+w /var/www/MyDomain1.com

    If needed restart SSHD or the VPS server to make sure that the permission has taken effect.
    To reset the SSHD server

    sudo systemctl restart sshd.service

    To reset the Apache server

    sudo service apache2 restart

    Or restart the VPS server:

    sudo restart now

    Chaining the commands together

    When you are setting up many sites try chaining together the commands using

    &&

    This will run all the commands one-by-one. If something goes wrong. The process will stop with an error message.

    sudo chown -R www-data /var/www/html/ && sudo chgrp -R www-data /var/www/html/ && sudo find /var/www/html/ -type f -exec chmod 644 {} \; && sudo find /var/www/html/ -type d -exec chmod 755 {} \; && sudo chown www-data:www-data -R /var/www/html/ && sudo usermod -aG www-data ubuntu && sudo chmod -R g+w /var/www/html/ && sudo chmod 660 /var/www/html/wp-config.php

    To make sure that the changes take effect. Restart apache and the SSHD server:

    sudo systemctl restart sshd.service
    
    sudo service apache2 restart

    Chaining commands are faster than running all these commands once at a time:

    sudo chown -R www-data /var/www/html
    
    sudo chgrp -R www-data /var/www/html
    
    sudo find /var/www/html -type f -exec chmod 644 {} \;
    
    sudo find /var/www/html -type d -exec chmod 755 {} \;
    
    sudo chown www-data:www-data -R /var/www/html/
    
    sudo usermod -aG www-data ubuntu
    
    sudo chmod -R g+w /var/www/html

    When you have many VPS servers

    WordPress JeOS servers are budget friendly. Instead of running the heavy load on a single server, it could be wise to distribute your WordPress sites to several EC2 VPS servers.
    Use your SSH client and log in to MyServer1.com, MyServer3.com, and MyServer2.com and verify that the user “ubuntu” has the rights to perform actions on all your websites on all of your VPS servers.

    When you want to WordShell to administer many VPS servers you need to configure SSH as described here:
    [themedy_button url=”https://www.wpjeos.no/prepare-ssh-file-folders-wordshell/” icon=”” font_awesome_att=”” label=”Setting up SSH to work with WordShell” colour=”blue” colour_custom=”” size=”large” edge=”rounded” target=”_self”]

    After this, you would be ready to administer all your WordPress sites on all of your VPS servers with WordShell, WP-CLI, SFTP and SSH from your mobile, tablet, Windows, Mac or whatever you choose as your favorite tools.

  • Resources

    FYI:  This page has affiliate links. It is still services that I recommend and use in my work.

     

    The DIY Thesis framework

    Since I do not want to spend time learning CSS and PHP I have used Thesis since 28. April 2010 for most of my WordPress work. The second reason for using Thesis is the personal support tickets I post frequently. The third reason for using Thesis is the support forum. I usually get help within 24 hours. In 2016 there wh was ere problems with Thesis and WP-CLI. After some months the issue was fixed in a newer version of Thesis. Thanks. Thesis is built on three features:

    • Boxes
    • Skins
    • Site tools

    With these features combined with use of forum and support ticket are you able to accomplish very much with WordPress without having programming skills. You should head over to their homepage to get all the details.

     

    Studiopress and Genesis themes and hosting

    Genesis framework from Studiopress is much the same as Thesis. Genesis is used by more people than Thesis. Genesis strictly follows the guidelines and recommendations from WordPress. I find Thesis to be easier to use. Genesis is used by more developers. Studiopress also provides hosting.

     

    Themedy WordPress child themes for Thesis and Genesis

    A large number of developer create attractive child themes for Thesis and Genesis WordPress framework. Both Chris Pearson, the creator of the Thesis framework and Brian Gardner the founder of Studiopress Genesis recommends the childthemes created by the Hodder brothers at Themedy.

     

    UpdraftPlus Migrator for changing domain name or changing to SSL

    This plugin is extremely useful for the following scenarios:

      • To avoid beeing penalized by Google, all websites should use SSL. Changing from http:// to httpS:// can sometimes be a struggle.

     

      • You should never use your bare domain. Allways put “www” or something else in front of the domain. Changing from https://WPJeOS.no to https://www.WPJeOS.no could sometimes be a struggle. For 20 years people has been unsure whether to use https://www. or not in a web site’s canonical name. The arguments found in the blog post from January 20, 2017 by Bjørn Johansen should make this obvious.

     

    • More frequent than you would expect does people change their domain name. There are many reasons. In any case is the UpdraftPlus Migrator a very helpful tool.

     

    WIX creates stunning websites for everyone

    Chances are that you just get fed up with technology, plugins, themes, things that don´t work. Sometimes a relative, family member, friend, customer or acquaintance needs help getting a website up and running and you just don´t feel beeing able to assist. Sometimes a client presents you with a budget that just not fit a WordPress job. Then WIX comes to the rescue. WIX is fast, simple and easy. Get a good looking website running in just a few minutes. Sometimes with your help. Sometimes close to anybody can create good results with WIX.

     

    Google Reviews plugin for WordPress plugin

    Reviews are more and more important for anyone selling almost anything. Asking for reviews are not always the job you prefer, but you should do it nevertheless. This plugin displays your Google Reviews in WordPress.

     

    VPS server with cPanel from Webhosting UK outside London

    Not all of us enjoy using a SSH client. Some require GUI admin panel. When I closed down my datacenter in 2008, all the websites was migrated to Webhosting UK. After nine years I am still amazed about the 24-7-365 support with the “Getting Things Done” attitude of this company. They are remarkable and outstanding. Their VPS server and reseller hosting with cPanel is for some customers a better choice than a WPJeOS server at Amazon.

     

    SSH clients for MAC, iPhone and iPad

    SSH Client for MAC

    SSH Client for iPhone

    SSH Client for iPad

    SSH Client for Windows

    SSH Client for Android

    vSSH is the client I have used for many years. It has a very nice key management feature. Easy to set up as a VPN client when using SOCKS Proxy when out of the office. This is a fast, userfriendly and trouble free SSH client.

     

    BlueHost VPS servers and shared hosting

    Bluehost is one of the larger providers of web hosting with a nice track record.

     

    ConvertKit is the user friendly e-mail marketing solution

    KonvertKit has many features but is yet easy to use.

     

    OptinMonster makes it easier to to populate your e-mail lists

    Use OptiMonster to get e-mail subscriptions to your ConvertKit lists. OpinMonster can be used to so much more than just getting e-mail subscribers.

  • Use SOCKS proxy for secure VPS connection to WordPress

    You can use your SSH to create a SOCKS proxy VPS connection to WordPress. Its very simple to set up a dynamic port forwarding in a SSH client vSSH.

     

    This procedure gives you a VPN connection. The SOCKS VPN setup enables you to access the Google PageSpeed admin page and WordPress through a secure tunnel. All you need is an SSH client on your PC. Nothing to install or configure on the server side.

    Unfortunately, this does not work on iPad and iPhone.