Recently, I want to build my own private blog, all kinds of Baidu, the complete construction steps are as follows!
First of all, you have to have your own vps or cloud host. I have my own cloud host here and have my own domain name (I haven't bought a domain name here yet)!
Build steps!
1. Install lnmp (linux+nginx+mysql+php). If you need to install it yourself, it may take a lot of time. We use direct brute force installation! ! !
wget http://soft.vpser.net/lnmp/lnmp1.4beta.tar.gz
tar -zxvf lnmp1.4beta.tar.gz
go into the directory
./install.sh takes about 30-60 minutes here! !
The following page appears:
Enter the numbers in front of the options you want to install in turn and press Enter to go to the next step.
MySql options
You have 5 options for your DataBase install.
1: Install MySQL 5.1.73 2: Install MySQL 5.5.53 (Default) 3: Install MySQL 5.6.34 4: Install MySQL 5.7.16 5: Install MariaDB 5.5.53 6: Install MariaDB 10.0.28 7: Install MariaDB 10.1.19 0: DO NOT Install MySQL/MariaDB Enter your choice (1, 2, 3, 4, 5, 6, 7 or 0):
Here you can choose according to your needs. If you use the above server, please choose 2 or press Enter directly. I choose default.
Note: When installing MySql, if you choose a version that is too high, the installation will be rejected, and the prompt information is as follows Memory less than 1GB, can't install MySQL 5.6, 5.7 or MairaDB 10!
. According to the personal experience of manually installing MySql5.7, this server with 768MB memory is fine when running a nginx, mysql, and php. If you run another tomcat, mysql will be down from time to time. So choose a lower version of 5.5MySql here.
You will install MySQL 5.5.53
===========================
Please setup root password of MySQL.(Default password: root)
Please enter:
Enter the password and press Enter or press Enter directly. The default password is root. For the experiment here, I choose the default, please modify it for personal use.
MySQL root password: root
===========================
Do you want to enable or disable the InnoDB Storage Engine?
Default enable,Enter your choice [Y/n]:
Enter Y or n and press Enter or press Enter directly. Press Enter directly to enable the InnoDB storage engine by default. I choose default.
No input,The InnoDB Storage Engine will enable.
===========================
You have 6 options for your PHP install.
1: Install PHP 5.2.17 2: Install PHP 5.3.29 3: Install PHP 5.4.45 4: Install PHP 5.5.38 (Default) 5: Install PHP 5.6.30 6: Install PHP 7.0.15 7: Install PHP 7.1.1 Enter your choice (1, 2, 3, 4, 5, 6 or 7):
Enter the option and then press Enter or press Enter directly, and press Enter directly to install PHP5.5.38 version by default. I choose default.
You will install PHP 7.1.1
===========================
You have 3 options for your Memory Allocator install.
1: Don't install Memory Allocator. (Default)
2: Install Jemalloc
3: Install TCMalloc
Enter the option and press Enter or press Enter directly. By default, the memory allocator is not installed. I choose default.
appears at this time
Press any key to install...or Press Ctrl+c to cancel
Of course, it is to press any key, usually it is Enter.
Then came a whole bunch of information. The first few lines are as follows:
You will install lnmp stack.
nginx-1.10.3
mysql-5.5.53
php-5.5.38 Enable InnoDB: y Print lnmp.conf infomation... Download Mirror: http://soft.vpser.net Nginx Additional Modules: PHP Additional Modules: Database Directory: /usr/local/mysql/var Default Website Directory: /home/wwwroot/default CentOS release 6.8 (Final) Kernel \r on an \m
You don't have to worry about all this stuff. The start time of this experiment is 23:04... After a long, long wait... It ends at about 23:35. So it's not a problem for you to take a shower and watch a TV show during the period. Then we see the last output information on the screen as follows.
http://IP
example .
http://45.32.195.77
What you see is the following:
The root directory path of the website /home/wwwroot/default
, if it is only used to put some static pages, then it is enough now, and you can directly throw your html, js, css and other files into it. This is not the focus of this article and will not be repeated here.
opt outctrl+c
Install WordPress
Download the WordPress package
The Chinese official site and the English official site are selected according to your own needs. The following takes the Chinese version as an example. The current latest version is 4.7.2
For convenience, we're still using the site's default path, but we're taking a chance.
# 进入根目录上一级目录
cd /home/wwwroot/
# 将default重命名为old
mv default old
# 下载WordPress包中文版
wget https://cn.wordpress.org/wordpress-4.7.2-zh_CN.tar.gz # 解压WordPress包 tar -zxvf wordpress-4.7.2-zh_CN.tar.gz # 查看解压后的文件夹名,此处是wordpress,估计应该都是吧,看看保险啊 [root@vultr wwwroot]# ls old wordpress wordpress-4.7.2-zh_CN.tar.gz # 将wordpress重命名为default mv wordpress default # 再次查看检验 [root@vultr wwwroot]# ls default old wordpress-4.7.2-zh_CN.tar.gz
Authorize the appropriate directory
# 目录以及目录下的文件授权
[root@vultr wwwroot]# chown -R 755 /home/wwwroot
chown: changing ownership of ‘/home/wwwroot/old/.user.ini’: Operation not permitted
# 将目录的所有者分给www组下的www用户。 [root@vultr wwwroot]# chown -R www:www /home/wwwroot/ chown: changing ownership of ‘/home/wwwroot/old/.user.ini’: Operation not permitted
The prompt that appears is probably saying that there is a file that cannot change user grouping and permissions. It won't affect your wordpress, just ignore it.
create a database wordpress
# 登录数据库
mysql -u root -p
# 输入密码
默认的话就是root,否则就是你自己之前设置的那个
# 登录进来之后,看到这样一些东西
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.5.53-log Source distribution Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> # 不用理会上面的,创建我们的数据库,比如名字为wordpress。记得加分号。 mysql> create database wordpress; # 看一下,有没有我们创建的数据库 mysql> show databases; # 大概看到如下内容。意味着这一步也没问题。 +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | wordpress | +--------------------+ 4 rows in set (0.01 sec) # 退出mysql exit
Configure WordPress
At this time, visit here through the browser. http://IP
For example http://45.32.195.77
, the browser will automatically jump to http://45.32.195.77/wp-admin/setup-config.php
the configuration page of wordpress. The content you see is as follows:
Enter the following information as previously set.
数据库名:wordpress 用户名:root 密码:root 数据库主机:localhost 表前缀:wp_
Click Submit.
At this point, it basically means that you are done, because there will be basically no mistakes later.
Click the Install button. The following figure appears:
Fill in according to your needs,
Click the Install WordPress button, and then log in to set the pure page operation, so I won't introduce it too much here.
OK After the installation is completed, only I write the article here. After publishing the article, I checked the article again and found 404 not fount nginx!!!!!!!!!!
Modify the nginx.conf file and add the following code under the location / node:
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
- 1
- 2
- 3
- 4
Then restart nginx to solve it.
ps -ef | grep nginx
Graceful restart command:
kill -HUP enter the name or process number file path
or use
/usr/nginx/sbin/nginx -s reload
Note that after modifying the configuration file, it is best to check whether the modified configuration file is correct, so as not to cause errors in Nginx after restarting, which will affect the stable operation of the server.
The command to judge whether the Nginx configuration is correct is as follows:
nginx -t -c /usr/nginx/conf/nginx.conf
or
/usr/nginx/sbin/nginx -t
nginx reload restart
implement
# /usr/local/nginx/sbin/nginx -s reload
nginx has been restarted successfully
Centos nginx restart
Restart Nginx
service nginx restart
/etc/init.d/nginx stop
/etc/init.d/nginx start