Steps for building a personal blog using HTTPS WordPress

Source: Internet
Author: User
Tags install wordpress ssl certificate certbot
Because I want to get https, and the tutorials on the Internet are not so comprehensive, I also find that the method for enabling https on WordPress is too complicated and unnecessary on the Internet, so here we will share our own setup process.

How to build a personal blog using WordPress

Overview

I built my own blog over the past few days and used WordPress

Because I want to get https, and the tutorials on the Internet are not so comprehensive, I also find that the method for enabling https on WordPress is too complicated and unnecessary on the Internet, so here we will share our own setup process.

Preparations

Not to mention a server

Domain name, I direct a second-level domain name to the blog directory, that is, the ssl certificate after this blog.xujifa.cn is directly assigned to this second-level domain name

Installation Process 1. Database

Install mariadb. of course, the same is true for mysql.

You can use this commandsudo yum install mariadb mariadb-server

After the password or something is set, log on to the database.

CREATE DATABASE wordpress;CREATE USER wordpressuser@localhost IDENTIFIED BY 'password';GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY 'password';FLUSH PRIVILEGES;EXIT;

Set the name or whatever you like.

II. Apache and PHP

Install apache:sudo yum install httpd mod_ssl mod_rewrite

Install php:sudo yum install php php-mysql

Start apache:sudo apachectl startIn the future.sudo apachectl restart

3. download WordPress

Currently, the latest version is 4.7.1. we strongly recommend that you use the English version. after you use the Chinese version, there is a problem on the interface. I'm not sure if it's a Chinese version, but one thing is that the English version is much faster than the Chinese version, I don't know why. it's just metaphysics.

wget https://wordpress.org/latest.tar.gz

Then move this/var/www/html/Directory

Extract

tar -xzvf lastest.tar.gz

Then, change the folder User to apache.

sudo chown -R apache /var/www/html/

Problem:

If the topic and plug-in cannot be downloaded during the use of WordPress, if you are prompted to require the ftp user name and password, try to re-run the above authorization command

Next, stop https and get wordpress. This may be better.

IV. Https

The free certificate issued by Let's Encrypt is used. It provides a tool called certbot to help issue the certificate. the following operations are performed:

sudo yum install python-certbot-apachesudo certbot --apche

You will be asked to enter the URL later.

Note that the validity period of the certificate is 90 days later. certbot also supports automatic renewal. run the following command:

sudo certbot renew --dry-run

When you access your website through https, you will find that there is a small green lock.

If your blog is not in the root directory, for example

https://blog.xujifa.cn

Point/var/www/html/blogIn this case, an additional operation is required.

Certbot will/etc/httpd/conf.d/Generatessl.confFile. in this file, find This tag, which containsDocumentRootAttribute, cancel its annotation, change its value to the desired path, and restart httpd.

Now our website should be accessible through http and https, which is a bit too difficult. we hope that http can be directed to https.httpdWhenmod_rewriteModule. now it's time to use it.

Open/etc/httpd/conf/httpd.confFile, find Tag, under whichAllowOverride NoneChangeAllowOverride All.

Then create a file named.htaccessTo add the following content.

RewriteEngine on RewriteBase / RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]
5. continue to install WordPress

In step 3, we decompressed WordPress in/var/www/html/Directory, enter the directory, and findwp-config-example.phpFile, rename itwp-config.php, Modify the information about the database (or you can set it through the webpage in the subsequent steps), and add these two sentences to set https

define('FORCE_SSL_ADMIN', true);define('FORCE_SSL_LOGIN', true);

Because WordPress uses google to provide some resources such as fonts and is walled, it also needs to be changed to a domestic source. here we use the resources provided by 360 to openwp-includes/script-loader.phpgoogleapisReplace allusesoYou can.

6. start using

Access our blog through a browser, set database information on the first page (skip this step if you have already completed the previous step), and set your username and password) then you can start using it.

The main content of this blog is so much. It should be enough if I haven't missed any of the above steps.

If you have any questions or are not clear about the article, please leave a correct message and I will reply as soon as possible.

The above describes how to build a personal blog using HTTPS WordPress. For more information, see other related articles in the first PHP community!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.