


Detailed explanation of how to build a WordPress personal website based on centos7
Jun 17, 2020 pm 01:34 PMThe following column WordPress Tips will introduce you to the detailed method of building a WordPress personal website based on centos7. I hope it will be helpful to friends in need. !
Foreword:
With the popularization of computer technology, more and more people are engaged in IT. But as you go deeper, you will find that you are on a pirate ship. It is really as deep as IT and the sea. From now on, girls are just passers-by. When you get closer and closer to the goal you have imagined, you will feel insignificant. , the knowledge in this industry is too profound and vast. Okay, without further ado, let’s start our topic: using wordpress to build a personal blog.
1. Environment preparation
Let’s first introduce the environment and the packages needed in the experiment
Environment:
I use The system is centos7.4
It is recommended to turn off selinux and the firewall policy affecting port 80
Package:
nginx (use the system Of course, you can also compile and install the packages in the default CD by yourself, but it is not recommended to build a personal blog because it is not necessary)
mariadb-server (The database uses maridb-server which is also in the local mirror of the system)
php-fpm (used to manage php programs, and nginx does not support php modules)
php-mysql (used to connect php to the database)
wordpress package, Official website address: https://wordpress.org/download/
wordpress theme: https://wordpress.org/themes/
#?yum?install?nginx?mariadb-server?php-fpm?php-mysql??-y #?systemctl?enable?nginx?mariadb?php-fpm???設(shè)置開機(jī)自啟
2. Each service configuration
Nginx
There are two ways to write nginx configuration files, directly writing to the main configuration, and writing to the conf.d folder. The second one is used here, but there is actually no difference
#?vim?/etc/nginx/nginx.conf 在http配置段里添加 http?{ ????fastcgi_cache_path?/var/cache/nginx/fcgi_cache?levels=1:2:1?keys_zone=fcgicache:20m?inactive=120s;??????????#特別注意:用來設(shè)置緩存的一些參數(shù),當(dāng)你要做多虛擬主機(jī)時(shí)一定要在重新設(shè)置以個(gè)并在server配置段里修改 } 這個(gè)主要是定義緩存的一些配置,可直接拿來用 #?vim?/etc/nginx/conf.d/blog.conf???#必須conf后綴 server?{ ????????listen???????80?;?????#監(jiān)聽地址 ????????server_name??blog.luckynm.cn?;???#域名 ????????root?????????/data/wordpress?;???#web的根路徑 ????????index?index.php?index.html?index.hml;???#默認(rèn)索引 ????????location?/?{ ????????????????try_files?$uri?$uri/?/index.php?q=$uri&$args; ????????} ????????location?~*?\.php$?{ ????????????????fastcgi_pass?127.0.0.1:9000; ????????????????fastcgi_index?index.php; ????????????????fastcgi_param?SCRIPT_FILENAME?$document_root$fastcgi_script_name; ????????????????include?fastcgi_params; ????????????????fastcgi_cache?fcgicache; ????????????????fastcgi_cache_key?$request_uri; ????????????????fastcgi_cache_valid?200?302?10m; ????????????????fastcgi_cache_valid?301?1h; ????????????????fastcgi_cache_valid?any?1m; ????????} ????????location?~*?^/(status|ping)$?{????????#用來查看網(wǎng)站的狀態(tài)信息,可以不添加 ????????????????fastcgi_pass?127.0.0.1:9000; ????????????????fastcgi_param??SCRIPT_FILENAME??$fastcgi_script_name; ????????????????include?fastcgi_params; ????????} ????????location?/files?{????????????#用來在網(wǎng)頁訪問文件夾,相當(dāng)于做了個(gè)文件夾映射,可根據(jù)個(gè)人情況添加 ????????????????root?/data/wordpress; ????????????????autoindex?on; ????????????????autoindex_exact_size?off; ????????????????autoindex_localtime?on; ????????} } nginx的配置基本就這些,如有疑問可以聯(lián)系我
MySQL
Enter mysql on the command line to enter the database
You can do some security configuration for the database, but I won’t demonstrate it here
#?mysql MariaDB?[(none)]>?create?user?'ningmeng'@'localhost'?identified?by?'XXXXXXX';??創(chuàng)建個(gè)給wordpress使用的連接數(shù)據(jù)庫的賬號(hào) MariaDB?[(none)]>?create?database?wordpress;??創(chuàng)建數(shù)據(jù)庫 MariaDB?[(none)]>?grant?all?privileges?on?wordpress.*?to?'ningmeng'@'%';???給ningmeng用戶授權(quán)
It is recommended to log in and test it after creating it
mysql?-uningmeng?-pXXXXXX
Php-Fpm
It has many parameters that can be set, and there are also many pitfalls. I will tell you here. Here are some things you need to pay attention to
#?vim?/etc/php-fpm.d/www.conf user?=?nginx????#設(shè)置所屬者所屬組,不設(shè)置的話在裝wordpress升級(jí)主題時(shí)有各種各樣的權(quán)限問題 group?=?nginx? pm?=?ondemand????#推薦使用這個(gè)模式,對(duì)他的詳細(xì)介紹參考http://blog.luckynm.cn/?p=65 pm.max_children?=?50????#這些都可以配置也可以默認(rèn),看情況 pm.start_servers?=?5 pm.min_spare_servers?=?5 pm.max_spare_servers?=?35 pm.status_path?=?/status pm.status_path?=?/status???#后面這三個(gè)是用來設(shè)置在web頁面上查看服務(wù)器狀態(tài)信息的,配合nginx種server段的配置使用 ping.path?=?/ping ping.response?=?pong
Wordpress
Don’t start it after completing the previous steps, because there may be order problems when starting them
Transfer the downloaded wordpress package to the local area. You can create a new folder to store it or place it directly in the /root directory.
It is recommended to use the Chinese package wordpress. -4.9.4-zh_CN.tar.gz
#?mkdir?-pv?/data???創(chuàng)建data目錄,這個(gè)要和nginx中root定義的根要一致 #?tar?xvf?wordpress-4.9.4-zh_CN.tar.gz?-C?/data/????解壓到/data目錄下 #?chown?-R?nginx:nginx?/data/wordpress????修改所屬者所屬組,不該沒辦法換主題升級(jí)插件,等一系列問題 #?cd?/data/wordpress #?mv?wp-config-sample.php?wp-config.php???設(shè)置配置文件 #?vim?wp-config.php define('DB_NAME',?'wordpress');?????WordPress數(shù)據(jù)庫的名稱 define('DB_USER',?'ningmeng');?????MySQL數(shù)據(jù)庫用戶名 define('DB_PASSWORD',?'970628');????MySQL數(shù)據(jù)庫密碼 define('DB_HOST',?'localhost');?????MySQL主機(jī)
Start
systemctl?start?mariadb??php-fpm systemctl?start?nginx?? 注意:php-fpm一定要在nginx前啟動(dòng),要不然會(huì)提示找不到緩存文件夾
Summary
The above is how we set up the blog For all content, you must pay attention to some configuration details during the construction process. Or maybe one parameter is not configured, and the entire architecture cannot be started. This article only represents my own opinions. Different systems have different configurations. I summarize Here are the common problems that friends may encounter, and share them with you here:
解決辦法:都是權(quán)限的問題,在php-fpm的/etc/php-fpm.d/www.conf里修改所屬者所屬組,默認(rèn)時(shí)apache user?=?nginx?? group?=?nginx 問題描述:服務(wù)器內(nèi)存小,mysql老自動(dòng)停機(jī) 解決辦法:???優(yōu)化下pfp-fpm就好啦,本文中提到啦優(yōu)化的方式,或參考:http://blog.luckynm.cn/?p=65 如果想要實(shí)現(xiàn)讓nginx顯示文件夾目錄可參考:http://blog.luckynm.cn/?p=120
The above is the detailed content of Detailed explanation of how to build a WordPress personal website based on centos7. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

There are four ways to adjust the WordPress article list: use theme options, use plugins (such as Post Types Order, WP Post List, Boxy Stuff), use code (add settings in the functions.php file), or modify the WordPress database directly.

Web development design is a promising career field. However, this industry also faces many challenges. As more businesses and brands turn to the online marketplace, web developers have the opportunity to demonstrate their skills and succeed in their careers. However, as demand for web development continues to grow, the number of developers is also increasing, resulting in increasingly fierce competition. But it’s exciting that if you have the talent and will, you can always find new ways to create unique designs and ideas. As a web developer, you may need to keep looking for new tools and resources. These new tools and resources not only make your job more convenient, but also improve the quality of your work, thus helping you win more business and customers. The trends of web development are constantly changing.

Importing WordPress source code requires the following steps: Create a sub-theme for theme modification. Import the source code and overwrite the files in the sub-topic. Activate the sub-theme to make it effective. Test the changes to make sure everything works.

To build a website using WordPress hosting, you need to: select a reliable hosting provider. Buy a domain name. Set up a WordPress hosting account. Select a topic. Add pages and articles. Install the plug-in. Customize your website. Publish your website.

Do you want to connect your website to Yandex Webmaster Tools? Webmaster tools such as Google Search Console, Bing and Yandex can help you optimize your website, monitor traffic, manage robots.txt, check for website errors, and more. In this article, we will share how to add your WordPress website to the Yandex Webmaster Tool to monitor your search engine traffic. What is Yandex? Yandex is a popular search engine based in Russia, similar to Google and Bing. You can excel in Yandex

Do you want to know how to use cookies on your WordPress website? Cookies are useful tools for storing temporary information in users’ browsers. You can use this information to enhance the user experience through personalization and behavioral targeting. In this ultimate guide, we will show you how to set, get, and delete WordPresscookies like a professional. Note: This is an advanced tutorial. It requires you to be proficient in HTML, CSS, WordPress websites and PHP. What are cookies? Cookies are created and stored when users visit websites.

Do you need to fix HTTP image upload errors in WordPress? This error can be particularly frustrating when you create content in WordPress. This usually happens when you upload images or other files to your CMS using the built-in WordPress media library. In this article, we will show you how to easily fix HTTP image upload errors in WordPress. What is the reason for HTTP errors during WordPress media uploading? When you try to upload files to Wo using WordPress media uploader

To create an account on WordPress, simply visit its website, select the registration option, fill in the registration form, and verify your email address. Other ways to register include using a Google account or Apple ID. The benefits of signing up include creating a website, gaining features, joining the community, and gaining support.
