Official Power Up Hosting Blog

Everything about Linux, Windows, and hosting ;)


I am an Online Marketer and technology lover. I like to learn new things and share that with people.


Our Newsletter

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.



Official Power Up Hosting Blog

How to Install WordPress (Caddy Server) on Ubuntu 16.04



Wordpress is the world's most used content management system and due to its compatibility and support, it started getting popular on early days.


The main reason is its user support and easy to use GUI with many options to handle any type of website.


Almost more than 60% of the website from around the world is running on the WordPress platform.

Instead of coding and creating a new page, you can build the page using visual composer or you can customize an existing and new theme to use them for your site.

All can be done within the WordPress.

This is an exciting platform to work with. It almost has all the options and functions to run any type of website.

All these you might have been using the Wordpress with LAMP stack or LEMP stack.

You might be a new guy who wanted to try the Caddy Web server or you are an expert who wants to try the caddy on Ubuntu.

When you go for the Caddy vs Nginx comparison, Caddy is very simple to configure.

Nginx is a bit complicated for the configuration.


You don't know, how to do it.

If you are such person, then no worries. This article is only for you.

In this tutorial, I am going to show you, How to install the WordPress with Caddy Server on Ubuntu 16.04.

Caddy is a new webserver software.

Caddy Web Server

Caddy Web server software was released only a few years ago (As of now, it is more than two years).

Since then, it started gaining popularity and used by small website owners and top web development professionals to host the website.

The main reason for the popularity is that the web server is easy to install and configure.

It comes with Automatic TLS encryption by Lets encryption and HTTPS/2 support.

When the load is going up, the Caddy software start to utilize the rest of the server core.

It makes the caddy performance better.

Let us see, How to install the Wordpress with Caddy in this article.

Caddy can work as a reverse proxy like Apache. Caddy reverse proxy reverse proxies to an internal server for the dynamic content.


Installing PHP

Basically, if you need to install WordPress, you will need the following things installed on your server.

  • MySQL
  • PHP
  • Web Server


Both Web Server and MySQL has already been installed on your server.

This time, you have to install the PHP.

First, update the server package index using the below command.

$ sudo apt-get update

Wordpress uses multi-byte strings, MySQL, curl and XML. So, you also need to install the additional extensions for them.

$ sudo apt-get install php7.0-fpm php7.0-mysql php7.0-curl php7.0-gd php7.0-mbstring php7.0-mcrypt php7.0-xml php7.0-xmlrpc

After the execution of the above command, the PHP will be installed on your machine.

You can check the installation of PHP and it's version using the below command.

$ php -v

You will get the following output or similar to this output.

PHP version output
PHP 7.0.18-0ubuntu0.16.04.1 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.18-0ubuntu0.16.04.1, Copyright (c) 1999-2017, by Zend Technologies


We have installed the required dependencies of WordPress.

After that, we have to configure the MySQL Database and User for the WordPress to use.

Create MySQL database and User

You have to create a MySQL database. You can give any name to the database.

To create a Database in MySQL, first, you have to enter into the MySQL from the command prompt.

For that use the below command.

$ mysql -u root -p

You have to enter the root password that you have set during the installation of MySQL.

Here, I am going to use the name "WordPress" for the database.

You can use any other name for your database.


Make sure to remember the name and use them in the upcoming command.

Here is the command to create a Database with the name "WordPress".

mysql> $ CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

After that, you have to create a user for that database and grant the access to the database.


I am going to create a user "wordpressuser".

You can use the name of your choice.

Create a strong password for the user.

mysql> GRANT ALL ON wordpress.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'password';


Flush the privileges to make the changes to take effect.


After that, exit the MySQL and return to the command prompt.

You have the dedicated user and database for the WordPress. The next step is to install the Wordpress.

Download the Wordpress

You have to download the latest release of WordPress into the web server root.

After that, you have to configure the web server for the WordPress to work.

Make sure the WordPress is accessible by the web server.

After the configuration, you have to finish the installation part through web GUI.


Change the location to /var/www using the below command.

$ cd /var/www

Always download the latest version of WordPress. The main reason for going to the new release is security updates.

Use the below command to download the latest version of compressed WordPress.

$ sudo curl -O

After that, extract the compressed file that you have downloaded.

$ sudo tar zxf latest.tar.gz

At last, you have to change the permissions of WordPress to make the web server access and make changes in WordPress file.

So that the WordPress will be automatically updated.

$ sudo chown -R www-data:www-data wordpress

If you don't like to auto update and disable the writing access to the WordPress, then the security will be improved since the attacker will not have a chance to find the bugs and loopholes to hack the site.

But, at the same time, auto update will be disabled and you will be unable to update the WordPress from the web interface.

The next task is making the modification in the web server configuration to work with WordPress.

Configuring the Web Server (Caddy)

Caddy web server download and installation process have been done already.

If you need more features, then you will require caddy plugins.


You have to make the caddy to know the location of WordPress installation and the domain request for which the WordPress site will be served.

Open the configuration file using nano editor. The configuration file for the caddy is located at /etc/caddy/Caddyfile.

$ sudo nano /etc/caddy/Caddyfile

Use the below code in the configuration file.

Just copy this file and past it on the web server configuration file.

             /etc/caddy/Caddyfile {
root /var/www/wordpress
fastcgi / /run/php/php7.0-fpm.sock php
rewrite {
    if {path} not_match ^\/wp-admin
    to {path} {path}/ /index.php?_url={uri}

Here is the explanation for that file.

  • - This is the domain name for which the WordPress site will be served.

  • - This is the email which will be used by the Letsencrypt to request the SSL certificate, In case if the certificate went missing.

The Recovery process can be initiated using this email id.

  • The root directive (/var/www/wordpress) points the location of the WordPress site.

  • gzip - This directive will make the website faster. It indicates the web server to use the Gzip compression to make the website much faster.

  • fastcgi - This directive indicates the web server to use the Fast CGI to configure the PHP handler to manage and support the PHP extension file.

  • rewrite - This directive is the most wanted for the WordPress user. It enables the permalink option in the WordPress.

In which the WordPress user can create their own custom URL. If you are using the Apache web server, then you would have enabled the permalink through the .htaccess file.


For the Caddy, it is different.

Once you make all the changes, save and exit the file. N


It is the time to restart the Caddy to make the changes to take effect.

Here is the command to restart the caddy.

$ sudo systemctl restart caddy

After that, you can access your website through the browser by entering the domain name.

When the caddy starts, it will automatically obtain an SSL certificate from the Lets Encrypt and provide the TLS secure connection.

You can notice the https and green colour which indicates the secure connection.


You are done with all the back-end process.

The Last task is to finish the WordPress installation through the GUI.

Complete WordPress installation through GUI


The WordPress installation has to completed through the GUI.

Enter the domain name in the browser and the Wordpress Setup wizard will be loaded in the browser.

First, it will ask you to select the language. You can select any of the languages from the list.

Then, you have to enter the database details which the Wordpress will ask for.

Here, fill the fields as mentioned below.

  • Database Name: It will be wordpress if you have not changed anything on the command.

  • Username: It will be wordpressuser. If you changed the name in the command, then enter that name here.

  • Password: Enter the password that you enter for your username. (Here, we enter the wordpressuser password)

  • Database Host: Leave the default value.

  • Table Prefix: Leave the default value.

After that, click on submit.

This time, the WordPress will verify the database detail. If anything wrong, the error will occur.

Then, you have to double check the detail. If all the details are correct, then you will receive the following messages.

All right, sparky! You've made it through this part of the installation. WordPress can now communicate with your database.


Click on the Run the Install.

After that, you will get the WordPress final setup screen which will ask you the following details.

  • Website title
  • Administrator account
  • Username and password
  • email address

The password will be auto-generated and it will be very strong.

You can use that password or you can create a password by yourself.

You should not use the "admin" for the username. The hacking techniques are always using the common username and password for hacking the site

So, it is recommended to have a unique username and strong password to prevent such attacks.

Then click on Install Wordpress. After that, you will be taken to the WordPress dashboard from where you can create pages and posts.


Here, in this article, you have learned how to install WordPress with Caddy on Ubuntu 16.04.

Caddy is becoming famous due to its simplicity. It also supports HTTP/2 and it can be installed on many platforms.

Caddy gets the SSL certificate automatically when restarting the web server and serves the website to the client over the secure connection.

So, Caddy redirect http to https automatically.

It also uses the Gzip compression to serve the website much faster. When the load increases, the Caddy automatically uses the other cores of the server to reduce the workload.

One of the disadvantages is you cannot use the Plugins which requires the .htaccess file.

Also, check the Caddy vs Nginx benchmark test here

There are only a few plugins who works with the .htaccess file. So, you don't need to worry about that.

Mostly, the web cache plugins are using the .htaccess file.

Make sure to sign up to receive notification for the upcoming tutorials.

If you have any doubt, leave them in the comment and we will help you in solving the issue.



I am an Online Marketer and technology lover. I like to learn new things and share that with people.