Install OLS, Mysql, Phpmyadmin, SSL, and Wordpress on Ubuntu 16.04

NoSo this was my first experience dealing with OLS and it was bit of a change of pace with a few things. So I figured I'd give you my best practices to get a fully functional Wordpress site running SSL and with full phpmyadmin.

Everything is done assuming you have a fresh install of Ubuntu 16.04 and SSH access with root.

Table of Contents

  1. Install MYSQL
  2. Install PHPMyAdmin
  3. Install OLS
  4. Install Wordpress
  5. Configure OLS
  6. Install and Configure SSL Certificates

1. Install MYSQL

  1. To ensure you are using the latest MYSQL go to their Downloads Page scroll to the bottom click the Download button. Scroll to the bottom again and right click "No thanks, just start my download." and copy link.
  2. Now we are going to move to a directory we can write in.
    cd /tmp
  3. Using Curl lets download MYSQL to /tmp
    $ curl -OL
  4. Now use the following command just to verify the file was downloaded.
  5. Lets go ahead and install.
    sudo dpkg -i mysql-apt-config*
  6. After it installs we need to refresh our apt package cache.
    sudo apt-get update
  7. Lets go ahead and remove the downloaded package since we don't need it anymore.
    rm mysql-apt-config*
  8. Now we are going to install MYSQL. You will be asked to set a root password, make sure it is secure.
    sudo apt-get install mysql-server
  9. With MYSQL installed lets verify it is running.
    systemctl status mysql
    You should see and output similar to below..keep in mind we want to see Active: active (running) as long as you see that we are gtg.
    ● mysql.service - MySQL Community Server
       Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
       Active: active (running) since Sat 2017-08-12 13:09:04 CEST; 4h 13min ago
      Process: 18892 ExecStartPost=/usr/share/mysql/mysql-systemd-start post (code=exited, status=0/SUCC
      Process: 18882 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCES
     Main PID: 18891 (mysqld)
        Tasks: 34
       Memory: 379.2M
          CPU: 3min 38.199s
       CGroup: /system.slice/mysql.service
               └─18891 /usr/sbin/mysqld
  10. Now with MYSQL running we need to secure it run the following:
    This will ask you for the root password you setup during MYSQL installation. After you enter the password it is going to ask a series of yes or no questions. Aside from password strength everything else I answer yes.
  11. Lets test MYSQL one last time before we move to PHPMYADMIN. When prompted for password use your MYSQL root password.
    mysqladmin -u root -p version


  1. We are going to refresh our apt package just out of habit and install phpmyadmin. Run each command sepearately.
    sudo apt-get update
    sudo apt-get install phpmyadmin php-mbstring php-gettext
  2. When the first prompt appears Apache2 is highlighted but not selected so press the space bar to select it then hit ok. It will run through the process and once it prompts you again it will ask you if you want to use dbconfig-common we are going to select NO. Reason why is we already have a MYSQL database setup.
  3. One more thing before PHPMYADMIN is up and running. Lets php extentions to support it.
    sudo phpenmod mcrypt
    sudo phpenmod mbstring
  4. Since we haven't installed OLS yet, lets restart apache and test that phpmyadmin loads.
    sudo systemctl restart apache2
  5. Now visit your site you should see:

  6. Now lets make a quick database to use for Wordpress install. Click New on the left menu and for database name choose which you want, for this tutorial we are calling it testdatabase and for Collation lets select utf8_general_ci .
  7. Securing PHPMYADMIN is a work in progress for me as I am having issues getting OLS to read the .htaccess for it. Once I do I will update this.
3. Install OLS

*This will be pretty much copy/paste from OLS site.*

  1. We need to copy the OLS 1-click script to our server. Again lets move to a tmp space.
    cd /tmp
  2. Now lets copy the script to your server using wget command.
  3. We are going to use chmod to make the script executable.
    chmod +x
  4. For this guide we are going to assume you want to use PHP7 and install only OLS without Wordpress being installed (I prefer to install wordpress separately). So lets run the following command:
    bash --lsphp 70
  5. You will see something similar to below, just confirm with a Y and let OLS install:

  6. Once OLS is installed lets go ahead and set up our own username and password. I know you can do it initially, but i have had inconsistencies when using it and this is just as easy.
    cd /usr/local/lsws/admin/misc
    Now issue the following command. You will see [admin] just input the desired username and hit enter. Then enter your desired password and hit enter.
  7. Let's verify OLS is up and running you can substitute with an ip address if needed. You should be able to log into OLS WebAdmin. Now lets get Wordpress installed and then we will configure OLS.
4. Install Wordpress
  1. Lets move to the DIRECTORY we want to download Wordpress too.
    cd /usr/local/lsws/
  2. We are going to use the wget command again to pull the latest Wordpress zip to our current directory which is /usr/local/lsws/.
  3. Now lets install zip package to unzip
    apt-get install zip
  4. Alright now lets unzip it should create a directory for Wordpress so that it is situated as /usr/local/lsws/wordpress.
  5. Now lets go into the /wordpress directory.
    cd wordpress
  6. We are going to configure Wordpress to work with our current database we setup earlier. First we will rename the wp-config-sample.php to wp-config.php using the following command.
     mv wp-config-sample.php wp-config.php
  7. Now we need to install nano so we can edit this config.
    apt-get install nano
  8. Now run the following command to edit our wp-config.php.
    nano wp-config.php
  9. You should see something similar to below. Use up, down, left, right arrows to move the cursor to areas you need to make changes. We are going to make 3 changes:

    *Use your database name and password set up in MYSQL below. Leave root as username.**

    define('DB_NAME', 'testdatabase');
    define('DB_USER', 'root');
    define('DB_PASSWORD', 'enterpassword');

  10. Once you have made the changes hold ctrl and press X. Now type in Y to confirm the changes then hit enter.

  11. Now lets create a .htaccess file use the following command and once you are in nano like above hold ctrl and press X then type Y and confirm the change.
    nano .htacces
  12. Now lets verify Wordpress folders are assigned to the appropriate user/group and files/folders have the correct permissions set. To do this type each command below in order.
    cd /usr/local/lsws/wordpress/
    chown -R nobody:nogroup /usr/local/lsws/wordpress/*
    sudo find . -type f -exec chmod 644 {} +
    sudo find . -type d -exec chmod 755 {} +

  13. Lets do one more thing before we move onto Configuring OLS and it will make sense in a little bit. We are going to create a new folder in /usr/local/lsws/conf/vhosts called wordpress. To do so lets run the following commands in order.
    cd /usr/local/lsws/conf/vhosts/
    mkdir wordpress
  14. One more thing to make sure OLS can create files in vhost folder. Lets run the following commands in order.
    cd ..
    chown -R lsadm:lsadm /usr/local/lsws/conf/vhosts/*
  1. We have set up Wordpress to connect to your MYSQL Database. Don't worry it will not load in your browser for you just yet since we haven't configured OLS just yet.
5. Configure OLS
  1. Finally we get to configure OLS and get this show on the road! Before we do we need to go ahead and stop the Apache2 process and restart OLS. So log into your OLS WebAdmin panel Once you are logged in go back to your ssh screen and run the following.
    service apache2 stop
  2. Now go back into OLS WebAdmin and click the green Graceful Restart icon like listed below. What we have done is stop Apache2 and restart OLS allowing it to run on a port that was occupied by Apache2.

  3. Now in OLS WebAdmin we are going to do the following.

    - Setup a Virtual Host and map it to our newly installed Wordpress directory.
    - Set appropriate Rewrite rules for Wordpress pretty links.
    - Set appropriate rules so we can access PHPMYADMIN again.
    - Configure listeners...lets get to it!

  4. Open up OLS WebAdmin on the left menu click Virtual Hosts. Once there we are going to create a new Virtual Host to do so click the Add button off to the far right. You should now see a screen like below. Only thing that needs to look different is the Virtual Host Name, put whatever you want there. Everything else mimic my options.

  5. Now click save in the top right menu. You will get a error below Config File input box. It says the file is not found and click here to create. Click to create the file and the screen will refresh and click save.

  6. Now click the General tab and make edits like below. The only changes we are adding are:

    Adding $VH_ROOT to Document Root
    Checking yes to Enable GZIP Compression
    Adding index.php to Index Files

  7. Now we are going to specify Rewrite and point to the .htaccess file we created in the Wordpress install. Just mimic the setup exactly as pictured.

  8. Now we need to tell OLS where phpmyadmin is we when we type in we can actually connect to it. Lets go ahead and click the Context tab. Go ahead and click add in the right portion of the screen. On the next screen just click the right arrow. On the next screen we are going to change these 3 lines.

    URI /phpmyadmin
    Location /usr/share/phpmyadmin
    Accessible Yes

  9. Click save do not restart just yet we have 1 more thing to add!

  10. Click Listeners on the left menu. Now click Add and fill in the blocks as listed in the picture. Also select No on Secure, forgot to picture it.

  11. Go ahead and click Save. Now you are back on the main listeners page. Click the view button, magnifying glass, for the new listener we just made. Now lets add a new Virtual Host Mapping by clicking the add button. In virtual host box click and select the virtual host we setup earlier and for domain place your website address in there. So . Now click save and then graceful restart the server.

  12. Now go ahead and type in your address and verify your Wordpress install is up and running! You can also verify PHPMYADMIN is back by going to
I am working on the SSL part of the tutorial now and it should be up within the hour :)

Couldn't edit my post to add SSL so here it is.

8. Install SSL and Configure with OLS
  1. This will be short and sweet, run the following commands to refresh apt, install any common files, add certbot repo and finally install certbot, will be used to issue the SSL certificates.
    sudo apt-get update
    sudo apt-get install software-properties-common
    sudo add-apt-repository ppa:certbot/certbot
    sudo apt-get update
    sudo apt-get install certbot
  2. Now that we have certbot installed we are going to run it to install your certificates. So go ahead run the following command and change out the with your domain. You will be asked to enter an email then two more prompts.
    sudo certbot certonly --webroot -w /usr/local/lsws/wordpress -d -d
    You will know everything went sucessfully if you have an output similar to below:
    Obtaining a new certificate
    Performing the following challenges:
    http-01 challenge for
    http-01 challenge for
    Using the webroot path /usr/local/lsws/wordpress for all unmatched domains.
    Waiting for verification...
    Cleaning up challenges

    - Congratulations! Your certificate and chain have been saved at
    /etc/letsencrypt/live/ Your cert
    will expire on 2017-11-10. To obtain a new or tweaked version of
    this certificate in the future, simply run certbot again. To
    non-interactively renew *all* of your certificates, run "certbot
    - Your account credentials have been saved in your Certbot
    configuration directory at /etc/letsencrypt. You should make a
    secure backup of this folder now. This configuration directory will
    also contain certificates and private keys obtained by Certbot so
    making regular backups of this folder is ideal.
    - If you like Certbot, please consider supporting our work by:

    Donating to ISRG / Let's Encrypt:
    Donating to EFF:

  3. Only thing we really need to take note of is where the certificates are located in this instance it is /etc/letsencrypt/live/ of course replace with your domain.

  4. Now lets install these certificates in OLS WebAdmin. So open back up your OLS WebAdmin and on the left menu select Listeners. Now lets select add a new listener. I named mine TestSite SSL then port is 443 and set Secure to Yes and save.

  5. Click on the SSL tab and then click edit SSL Private Key & Certificate. Now we are going to add the directory for our private key and certificate. Here is what you should place in each and I have included a picture of how it should look.

  6. Repeat the same steps for your initial Listener we made for port 80, leaving the port alone but changing everything else.

  7. Now save these settings and go for a graceful restart.

  8. Go ahead and type in into the browser and you are running secure. One more thing to do is go into Wordpress and Settings then General and change the following to https instead of http:

    WordPress Address (URL)
    Site Address (URL)

That is it, hopefully my hours of tinkering and making this has helped you better understand LiteSpeed[/QUOTE]​
need a little help here, i skipped the part where you install wordpress since i won't use it, i did every other step, when i came to the step where you said "context" in 5.8 part, i did exactly that but i can't seem to get to work, i get this "Request Page Not Found", any help on this?
btw how do i get upload_max_filesize changed on phpmyadmin? i tried changing /usr/local/lsws/lsphp70/etc/php.ini restarted, but it doesn't take effect
what we can do for windcard ssl. or wpmu sites
i can add ssl formy root site but cant add my subsites. my subsites with subdomain (eng: of others domains (eng:
what can I do

Sorry for point 10 "Click Listeners on the left menu. Now click Add and fill in the blocks as listed in the picture. Also select No on Secure, forgot to picture it " , i cant found the picture.