How to optimize WordPress with Ubuntu VPS

Ubuntu Virtual Private Server optimized for WordPress

Author: .

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

  • Adding SSL certificate from CloudFlare

    CloudFlare.com provides a free valid SSL certificate.
    After installing this certificate, can you change the CloudFlare SSL settings from “Full” to “Strict.”

    Create a .pem file for the server certificate

    nano MyDomain-com-server.pem

    Paste and copy the server certificate from CloudFlare.com into this file. Then save the file.
    Move the server certificate to the correct folder:

    sudo mv MyDomain-com-server.pem /etc/ssl/certs/MyDomain-com-server.pem

    Then create the private certificate:

    nano MyDomain-com-private.pem

    Move the server certificate to the right folder:

    sudo mv MyDomain-com-private.pem /etc/ssl/private/MyDomain-com-private.pem

    Modify the Apache config file to use the certificates

    The config files are located at:

    cd /etc/apache2/sites-available

    Open the config file:

    sudo nano 01-MyDomain1-com.conf

    Find the lines:

    SSLCertificateFile      /etc/ssl/certs/ssl-cert-snakeoil.pem
    SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
    

    Change the lines to reflect your newly created credentials. It would the look like this:

    SSLCertificateFile /etc/ssl/certs/MyDomain-com-server.pem 
    SSLCertificateKeyFile /etc/ssl/private/MyDomain-com-private.pem

     

    Rights and ownership on certificates

    Directory permissions should be 710 for the private keys.

    File permissions on the certificates 644 for the private keys.

    It is recommended that the directory and files should be owned by root

    Change the owner and group:

    sudo chown root:ssl-cert -R /etc/ssl/private

    Change the permissions on files:

    sudo find /etc/ssl/private -type f -exec chmod 644 {} \;

    Change the permissions on folders:

    sudo find /etc/ssl/private -type d -exec chmod 710 {} \;

     

    All the files in the cert folders should be owned by root

    sudo chown root:root -R /etc/ssl/certs/

    Short version of adding the certs

    Private cert
    sudo mv MyDomain-com-private.pem /etc/ssl/MyDomain-com-private.pem
    
    sudo chmod 644 /etc/ssl/private/MyDomain-com-private.pem
    
    sudo chown root:ssl-cert /etc/ssl/private/MyDomain-com-private.pem
    Server cert
    sudo mv MyDomain-com-server.pem /etc/ssl/certs/MyDomain-com-server.pem
    
    sudo chown root:root -R /etc/ssl/certs/MyDomain-com-server.pem
    
    sudo chmod 644 /etc/ssl/certs/MyDomain-com-server.pem

     

    Check the Apache config file

    sudo apachectl configtest

    Restart Apache web server

    sudo service apache2 restart

    Check the different Apache error logs

    It is alway a good habit to have a look at the error logs.

    cd /var/log/apache2/
    sudo nano error.log
    sudo nano 01-mydomain-com-error.log
  • Configure SSH for administration of remote VPS servers with WordShell

    You can manage many EC2’s or VPS servers with WordShell. You need to configure the SSH config file to log in to remote VPS servers with SSH and SFTP. This is a requirement for WordShell.Here is how:

    Configure SSH

    Upload all your .pem files that contain your SSH keys with FTP to:

    /home/ubuntu/

    Then move them to the SSH config folder

    mv *.pem /home/ubuntu/.ssh/

    You receive  an error message unless you change the permission to 600

    chmod 600 /home/ubuntu/.ssh/*.pem

    Now it is time to create the configuration file.

    nano /home/ubuntu/.ssh/config

    Change the IP addresses and domain name to suit your settings. Replace “MyServer1.com” and 888.888.888.888 with your domain and your IP. In this config file, there are 3 EC2 servers.

     

    Host MyServer1.com
    Hostname 888.888.888.888
    User ubuntu
    IdentityFile /home/ubuntu/.ssh/MyServer1.com.pem
    
    Host MyServer2.com
    Hostname 888.888.888.888
    User ubuntu
    IdentityFile /home/ubuntu/.ssh/MyServer2.com.pem
    
    Host MyServer3.com
    Hostname 888.888.888.888
    User ubuntu
    IdentityFile /home/ubuntu/.ssh/MyServer3.com.pem
    

    Save the config file.
    Protect the data:

    chmod 600 /home/ubuntu/.ssh/config

    Verify that you can log onto the servers
    Test that you can connect to the 3 EC2 servers by typing

    ssh MyServer1.com
    ssh MyServer2.com
    ssh MyServer3.com

    Set the correct permissions for the Apache and the user ubuntu 

    To avoid error messages make sure that the files and folders on the remote VPS servers have the right access rights. The user that logs on to the remote VPS server must have permissions to manage the files and folders that make WordPress.

    This post has all the details:

    [themedy_button url=”https://www.wpjeos.no/give-user-ubuntu-server-apache-rights-run/” icon=”” font_awesome_att=”” label=”Set the right permissions for Apache and the ubuntu user” colour=”blue” colour_custom=”” size=”large” edge=”rounded” target=”_self”]

  • How to install WordPress through command-line with WP-CLI

    Setting up WordPress using the command line is fast.
    You can even use a script to automate the process.

    Home » Archives for . » Page 10

    Prerequisites and preparations

    Before you begin. Create a MySQL database in Amazon RDS. You also need a working website. Then start creating a list with the following information:

    • Name of your Amazon RDS MySQL database server
    • Database name
    • Database username
    • Database user password
    • The WordPress admin username you intend to use
    • The WordPress admin password you intend to use
    • The WordPress admin e-mail address you plan to use

    If some points are unclear these how-tos should point you in the right direction:
    How to install WP-CLI

    How to set up a virtual host

    How to activate .htaccess

    How to create a MySQL database in Amazon RDS

    Verify the root folder

    Your root folder is beneath

    /var/www/

    In this tutorial are we going to install WordPress in the folder

    /var/www/MyDomain1.com

    Start with going to the root folder:

    cd /var/www/MyDomain1.com

    Verify that there are no files in this folder

    sudo ls

    If here is index.html or another start page file there you should delete this file to avoid problems later on.

    sudo -u www-data rm index.html

    Change ownership and delegate permissions

    The Apache web server needs permission to run WordPress.

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

    Download the installations files

    Downloading all the WordPress files is done in a matter of seconds by issuing this command:

    wp core download
    
    

    Create wp-config.php, the main configuration file

    Sometimes WP-CLI is unable  to connect to Amazon RDS MySQL database. Then you can skip the database test by adding the following statement:

     --skip-check

    Creating the configuration file in WordPress. Fill in the values from the list you created previously:

    wp core config --dbname=wordpress --dbuser=user --dbpass=password --dbhost=dcfgvr.1bagob.0002.euw1.cache.amazonaws.com --dbprefix=wp_ --skip-check

    Install WordPress

    wp core install --url="https://www.example.com" --title="Blog Title" --admin_user="adminuser" --admin_password="password" --admin_email="email@domain.com"

    Check the server error logs

    It’s a good practice to examine the error logs. They are here:

    cd /var/log/apache2/
    sudo nano error.log
    sudo nano 01-mydomain1-com-error.log

    Set correct permissions so Apache can access the files and folders

    Basic permission:

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

    More thorogh guide on setting permissions is available her:

     
     
     
  • How to run WordPress on your OS X Mac and Windows

    Running WordPress on your Mac OS X or Windows computer has many advantages. There are two different concepts for doing this:

    • Running a virtual private server – VPS – on your Mac or Windows
    • Running Apache, PHP and MySQL on your Mac or Windows

    Both solutions have its advantages and downsides.

    Running PHP, MySQL and Apache on your PC is the easiest and best solution if you are aiming at creating websites. Running a VPS would be the choice if you are developing or programming.

    Do you prefer using WP-CLI and WordShell? Then you should choose a VPS based solution.

    In TBT we currently use MAMP Pro. In the future, we might also be using VMware Fusion for individual projects. In general, we find MAMP Pro faster because we can use the file manager “Finder” in Mac when moving files and folders between the local disk and WordPress.

    Solutions that runs PHP, MySQL, and Apache on your computers OS:

    • Manually installing Apache, MySQL, and PHP
    • MAMP
    • AMPPS Stack
    • VirtualHostX version 6

    Solutions for running VPS on your computer:

    • VirtualHostX version 7
    • Primary Vagrant
    • Varying-Vagrant-Vagrants
    • Oracle VM VirtualBox
    • VMware Fusion for MAC
    • VMware Workstation for Windows
    • Parallels Desktop for Mac
    • Microsoft Hyper-V

    Manually installing Apache, MySQL, and PHP on Mac and Windows

    On both Mac and Windows, you can download Apache, MySQL and PHP and then configure your computer. Mac OS X comes pre-installed natively with Apache and PHP so you only need to install MySQL.

    MAMP

    Apache, MySQL, and PHP for OS X and Windows

    Find the details here:

    https://www.mamp.info/en/

    AMPPS Stack

    AMPPS is a software stack containing Apache, Mysql, PHP. Consist of the Softaculous auto-installer. AMPPS should be used on Desktops and office servers.

    http://www.ampps.com

    VirtualHostX

    VirtualHostX 7.0 lets you host and share as many websites as you like with your Mac. This is a suitable solution when you are creating more than one website simultaneously. With VirtualHostX, you can manage many Apache sites at the same time with just a few clicks.

    https://clickontyler.com/virtualhostx/

    Primary Vagrant

    This is an Apache-based Vagrant configuration for WordPress development.

    Primary Vagrant is a tool for WorPress plugin, theme, and core development. You can also use PV as a general PHP development environment. Primary Vagrant is a replacement for MAMP and XAMPP.

    Varying Vagrant Vagrants usesNGINX webserver. Primary Vagrant uses Apache. PV uses Puppet instead of Bash. PV uses VVV and Puppet as a base and is more focused on WordPress development.

    https://github.com/ChrisWiegman/Primary-Vagrant

    Varying-Vagrant-Vagrants/VVV

    Vagrant is a VPS server that runs on top of VirtualBox of VMWare on your local machine.

     

    https://varyingvagrantvagrants.org

    Oracle VM VirtualBox

    https://www.virtualbox.org

    VMware Fusion

    http://www.vmware.com/products/fusion

    VMware Workstation for Windows

    https://www.vmware.com/products/workstation

    Parallels Desktop for Mac

    http://www.parallels.com/eu/products/business/

     

    Microsoft Hyper-V

    Microsoft Hyper-V is a part of the Microsoft Windows operating system. You can activate Hyper-V in the Windows 10 Control panel. Choose between creating your own or download prebuilt VPS images with WordPres installed and ready to run.