Tips for Installing WordPress Using Caddy on CentOs 7

How about easy Install WordPress tips? Before reading further. Here is the explanation.

WordPress is a popular content management system (CMS). It can be used to quickly and easily create blogs and websites, and almost all of its administration is possible through the web interface.

In most cases, WordPress is installed using a LAMP or LEMP stack (i.e. using Apache or Nginx as the web server). In this wordpress setup tutorial, we will set up WordPress with Caddy. Caddy is a new web server that is rapidly gaining popularity due to its unique features, such as HTTP/2 support and automatic TLS encryption with Let’s Encrypt, a popular free certificate provider.

In this easy website tutorial, you will install and configure Caddy-powered WordPress.

Step 1 — Install PHP

  • First, make sure your package is the most up to date
sudo yum update
  • Install PHP and PHP extension depending on WordPress, what is needed like MySQL, curl, XML, and multi-byte String
sudo yum install php php-fpm php-mysql php-curl php-gd php-mbstring php-mcrypt php-xml php-xmlrpc
  • If the installation is complete you can check the PHP version, by:
php –v
  • You will see the result like this:
PHP version output

PHP 5.4.16 (cli) (built: Nov  6 2016 00:29:02)

Copyright (c) 1997-2013 The PHP Group

Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

Before we can proceed with the wordpress setup tutorial, we have to modify the configuration file for the PHP service a bit so that we can use our inexperienced caddy user to run the server. The default configuration on CentOS assumes that Apache is the server of choice.

  • Open the PHP-FPM configuration file with vi or your favorite text editor. Here’s a quick introduction to vi if you’re not familiar with it.
sudo vi /etc/php-fpm.d/www.conf
  • Find the fragment with the specified user account and group:
/etc/php-fpm.d/www.conf

; Unix user/group of processes

; Note: The user is mandatory. If the group is not set, the default user's group

;       will be used.

; RPM: apache Choosed to be able to access some dir as httpd

user = apache

; RPM: Keep a group allowed to write in log dir.

group = apache
/etc/php-fpm.d/www.conf

;

Unix user/group of processes ; Note: The user is mandatory. If the group is not set, the default user's group ;       will be used. ; RPM: apache Choosed to be able to access some dir as httpd user = caddy ; RPM: Keep a group allowed to write in log dir. group = caddy
  • Save and close the file to return, . To activate the caddy so that it can communicate with PHP, start the PHP service.
sudo systemctl start php-fpm

Step 2 —Creating MySQL Database and Dedicated User

WordPress uses a MySQL database to store all of its information. In the default MySQL installation, only the root root account is created. This account should not be used because unrestricted privileges to the database server are a security risk. Here, we will create a custom MySQL user for WordPress to use and a database that new users will be allowed to access.

  • First, login to the MySQL administrative root account.
mysql -u root –p

You will be asked to set a password for the MySQL root

  • Create a new database with the name wordpress that will be used for the easy website tutorial WordPress website. You can use a different name, but make sure you remember it for additional configuration later.
CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
  • After that, create a user who will access the database. Here, we use the wordpressuser user to make it simple, but you can choose your own username.
GRANT ALL ON wordpress.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'password';
  • Flush privileges to notify the MySQL server of changes.
FLUSH PRIVILEGES;

EXIT;

Step 3 — Download WordPress

  • In this step of the wordpress setup tutorial, we need to configure the web server before we can access the GUI.

First, change the current directory to /var/ www :

cd /var/www
  • Download the latest WordPress. It is very important to use the latest because the software is frequently updated with security patches.
sudo curl -O https://wordpress.org/latest.tar.gz
  • Extract the file that you downloaded earlier
sudo tar zxf latest.tar.gz
  • This will automatically create a new directory called wordpress. You can now safely delete downloaded archives, as they are no longer needed.
sudo

rm latest.tar.gz
  • The last step is to change the wordpress premissions and directory:
sudo chown -R caddy:caddy wordpress

Step 4 — Config Caddy -> Serve WordPress Website

In this easy website tutorial, we will change the Caddyfile configuration to tell the caddy where to install wordpress

  • Open the configuration using vi or another according to your favourite:
sudo vi /etc/caddy/Caddyfile
  • copy and paste the configuration. You can change it with several configurations as below
/etc/caddy/Caddyfile

example.com {

    tls [email protected]

    root /var/www/wordpress

    gzip

    fastcgi / 127.0.0.1:9000 php

    rewrite {

        if {path} not_match ^/wp-admin

        to {path} {path}/ /index.php?_url={uri}

    }

}
  • restart Caddy so that the changed configuration can run
sudo systemctl restart caddy

Step 5 — Config WordPress

WordPress has a GUI installation wizard to complete its setup, including connecting to the database and setting up your website.

When you visit your new WordPress instance in the browser for the first time, you will see a list of languages. Select the language you want to use. On the next screen, describe the required information about your database. Click Let’s go!, and the next page will ask for database connection details. Fill in this form as follows:

  • DatabaseName -> wordpress.
  • Username -> wordpressuser.
  • Password -> the password you set earlier in Step 2.
  • Database Host and Table Prefix adjust to default.

When you click Submit, WordPress will check if the details provided are correct. If you receive an error message, double check that you have entered your database details correctly doing the wordpress setup tutorial.

Once WordPress has successfully connected to your database, you will see a message starting with All right, sparky! You’ve made it through this part of the installation. WordPress can now communicate with your database.

Now you can click Run the install to start the installation. After a few moments, WordPress will ask for your website details, such as website title, administrator account username, password, and e-mail address. A strong password will be automatically generated for you, but you can choose your own if you want.

Well, to maximize WordPress performance. You can use WordPress Hosting Indonesia which is specifically created for WordPress website users. Tips make it easier for users to maintain the website. So you just have to focus on developing the content you have. Not without reason, because creating quality content will certainly affect the continuity of your online business as well.