How to optimize WordPress with Ubuntu VPS

Ubuntu Virtual Private Server optimized for WordPress

Author: .

  • 99 CloudFlare IP module for Apache

    .htaccess files with access control and apps like the anti-spam module from Automatic / WordPress wil not work unless the correct IP address is displayed.
    (more…)

  • 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”]

     

     

     

     

     

  • How to backup the Apache config file

    UpdraftPlus and other WP backup solution’s safeguards the work you have performed in WordPress. The Apache configuration files are left out. When disaster strikes, access to the Apache config files is invaluable. This might save you hours and perhaps days of downtime and frustration.

     

    Automate the process

    Below is the command listed one by one.
    A shell script that runs once a month from Cron would automate this.
    With TextExpander could you run this command sequence from your PC, Mac, iPhone and iPad as a snippet. To distinguish and automatically sort the backups the folders and filenames start with today’s date in the form: year-month-day

     

    Save the backup files in a single folder

    Create a folder you can access with SFTP and SCP. Then it’s easier to move the backup offsite. Either to your PC or another server or service. If you also choose to keep a local backup on the WP-JeOS server remember to change permissions on the file and folders. The bad guys would just love access to your SSL-certificates!

    cd /home/ubuntu/
    mkdir 20160627-backup-wp-jeos
    cd 20160627-backup-wp-jeos

    Now we are ready to start the work creating a backup of the Apache config files.

    Backing up SSL certificates

    Create a backup of the certificates

    sudo zip -r 20160627-etc-ssl-certs-.zip /etc/ssl/certs/*.*

    Create a backup of the private certificates
    First become root

    sudo su

    Then create the zip file:

    sudo zip -r 20160627-etc-ssl-private-.zip /etc/ssl/private/*.*

    Go back to the user ubuntu

    exit

     

    Backing up Apache main config file

    You have appropriately modified the main Apache config file to make the .htacces file work correctly.

    sudo zip 20160627-etc-apache2-apache2-conf.zip /etc/apache2/apache2.conf

    Backing up the virtual hosts config files

    The virtual hosts configuration files for each and every WordPress site might take much work to re-create when disaster strikes. A backup is a real time saver. The .conf file contains the path to your SSL-certificates, specifies the filename of your error logs and access logs and info about the root folder of WordPress.

    sudo zip -r 20160627-etc-apache2-sites-available-.zip /etc/apache2/sites-available/*.*

    Backup of the Apache config files completed. Now create a TextExpander snippet and perhaps a batch job to perform this fast next time you modify them. A cron job based on the bash script would further automate.

    Manually backing up WP-JeOS

    When you are at it, backing up the rest of WP-JeOs is easy. Sometimes backups are un-restorable. It could be many reasons for that. Having backups created with different solutions could be wise.

    Backing up the file structure

    When you have many websites creating a zip-file of the structure is done with this command. Beware. The zip-file could end up to being massive.

    sudo zip -r 20160627-var-www-.zip /var/www/

    A real timesaver when you need to migrate the whole server. It would usually take less time than restoring one site at a time with UpdraftPlus. Keep in mind that WP-CLI and WordShell are great tools when migrating, creating backups and restoring. WordShell has an excellent integrated backup solution.

    Backing up databases

    Since we run Amazon RDS MySQL, backup of the databases is less critical. Amazon automatically creates database backups for you. Use the RDS control panel to configures database backups. Modify to fit your needs. Eventually, the RDS backups are overwritten. If it takes months to the problem, corruption or whatever goes wrong is detected. Then a local offsite backup is the only thing that can come to your rescue. Creating backups with free software is easy. Try these:

    • MySQL Workbench
    • Sequel Pro
    • Navicat

     

     

    Move the backup offsite

    Backup files on a server that you can not access are worthless. Copy or move the backup offsite to another server or service like DropBox, Google Drive or Amazon S3.  You never know what’s ahead.

    Verify the backup

    Download the backup to your PC. Unzip the files to verify that the zip files contains the intended content.

    Restore to a local VPS

    VmWare is a great tool. Test that you can regenerate the server to a new VPS running on your PC. VmWare is a user-friendly tool for running Ubuntu on you local workstation. Restoring backups requires practice. It could occur that you are unable to restore a backup. The backup might be incomplete or corrupt. You could run into unforeseen problems when restoring backups. There might be a 3. party plugins or locked software that requires a particular IP to work. Certificates that is locked to a certain environment. It could be many obstacles occurring that you could not foresee or has forgotten. Usually, disaster recovery is a very stressful situation that in the long term is damaging to your health. Practice enables you to perform migration faster and with less wear and tear on your health.

    Protect the backup

    If you keep backups on the WP-JeOs, then you should change the permissions to the files and folders. The backup contains your passwords, SSL-certs and lots of valuable stuff that the bad guys just would love to access.

  • Update WordPress, plugins and themes using WP-CLI and Cron

    Using CRON to automatically update themes, plugins and WordPress core saves you a lot of time and will keep your sites and server secure.

    Learn how to use cron to update WordPress