Deploy WordPress on LNMP
WordPress China,官网:http://cn.wordpress.org/
Download Link is:https://cn.wordpress.org/wordpress-4.1-zh_CN.zip
上传安装介质到服务器:
1 2 3 4 5 |
[root@adamhuanlinux ~]# ls /software | grep wordpress wordpress-4.1-zh_CN.zip [root@adamhuanlinux ~]# du -sh /software/wordpress-4.1-zh_CN.zip 6.9M /software/wordpress-4.1-zh_CN.zip [root@adamhuanlinux ~]# |
创建WEB应用目录,并解压安装介质:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
[root@adamhuanlinux wordpress]# pwd /var/web_app/wordpress [root@adamhuanlinux wordpress]# [root@adamhuanlinux wordpress]# ls wordpress-4.1-zh_CN.zip [root@adamhuanlinux wordpress]# [root@adamhuanlinux wordpress]# unzip wordpress-4.1-zh_CN.zip ... ...etc inflating: wordpress/wp-admin/admin.php inflating: wordpress/wp-admin/edit-form-advanced.php inflating: wordpress/wp-admin/ms-themes.php inflating: wordpress/wp-admin/freedoms.php inflating: wordpress/wp-admin/options-reading.php inflating: wordpress/wp-admin/press-this.php inflating: wordpress/readme.html [root@adamhuanlinux wordpress]# [root@adamhuanlinux wordpress]# ls wordpress wordpress-4.1-zh_CN.zip [root@adamhuanlinux wordpress]# ls wordpress/ index.php wp-activate.php wp-comments-post.php wp-cron.php wp-load.php wp-settings.php xmlrpc.php license.txt wp-admin wp-config-sample.php wp-includes wp-login.php wp-signup.php readme.html wp-blog-header.php wp-content wp-links-opml.php wp-mail.php wp-trackback.php [root@adamhuanlinux wordpress]# [root@adamhuanlinux wordpress]# mv wordpress/* . [root@adamhuanlinux wordpress]# ls index.php wordpress wp-admin wp-config-sample.php wp-includes wp-login.php wp-signup.php license.txt wordpress-4.1-zh_CN.zip wp-blog-header.php wp-content wp-links-opml.php wp-mail.php wp-trackback.php readme.html wp-activate.php wp-comments-post.php wp-cron.php wp-load.php wp-settings.php xmlrpc.php [root@adamhuanlinux wordpress]# ls wordpress [root@adamhuanlinux wordpress]# |
准备数据库环境:
在MySQL中,为Wordpress创建单独的库,以存放相应的数据:
1.建库:wordpress_data
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
[root@adamhuanlinux wordpress]# ps -ef | grep mysql root 985 1 0 09:34 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/adamhuanlinux.pid mysql 2198 985 0 09:35 ? 00:00:02 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/adamhuanlinux.err --pid-file=/var/lib/mysql/adamhuanlinux.pid root 5760 3158 0 11:16 pts/0 00:00:00 grep --color=auto mysql [root@adamhuanlinux wordpress]# [root@adamhuanlinux wordpress]# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.6.23-enterprise-commercial-advanced MySQL Enterprise Server - Advanced Edition (Commercial) Copyright (c) 2000, 2015, 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> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | test | +--------------------+ 4 rows in set (0.02 sec) mysql> create database wordpress_data; Query OK, 1 row affected (0.00 sec) mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | test | | wordpress_data | +--------------------+ 5 rows in set (0.00 sec) mysql> |
2.分配权限:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
mysql> use mysql; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> select user,host,password from user; +------+---------------+-------------------------------------------+ | user | host | password | +------+---------------+-------------------------------------------+ | root | localhost | *2447D497B9A6A15F2776055CB2D1E9F86758182F | | root | adamhuanlinux | *2447D497B9A6A15F2776055CB2D1E9F86758182F | | root | 127.0.0.1 | *2447D497B9A6A15F2776055CB2D1E9F86758182F | | root | ::1 | *2447D497B9A6A15F2776055CB2D1E9F86758182F | +------+---------------+-------------------------------------------+ 4 rows in set (0.00 sec) mysql> grant all privileges on wordpress_data.* to wordpress_admin identified by '******' with grant option; Query OK, 0 rows affected (0.00 sec) mysql> select user,host,password from user; +-----------------+---------------+-------------------------------------------+ | user | host | password | +-----------------+---------------+-------------------------------------------+ | root | localhost | *2447D497B9A6A15F2776055CB2D1E9F86758182F | | root | adamhuanlinux | *2447D497B9A6A15F2776055CB2D1E9F86758182F | | root | 127.0.0.1 | *2447D497B9A6A15F2776055CB2D1E9F86758182F | | root | ::1 | *2447D497B9A6A15F2776055CB2D1E9F86758182F | | wordpress_admin | % | *4AD47E08DAE2BD4F0977EED5D23DC901359DF617 | +-----------------+---------------+-------------------------------------------+ 5 rows in set (0.00 sec) mysql> |
配置:wp-config.php
1 2 3 4 5 6 7 8 9 10 |
[root@adamhuanlinux wordpress]# pwd /var/web_app/wordpress [root@adamhuanlinux wordpress]# ls index.php wordpress wp-admin wp-config-sample.php wp-includes wp-login.php wp-signup.php license.txt wordpress-4.1-zh_CN.zip wp-blog-header.php wp-content wp-links-opml.php wp-mail.php wp-trackback.php readme.html wp-activate.php wp-comments-post.php wp-cron.php wp-load.php wp-settings.php xmlrpc.php [root@adamhuanlinux wordpress]# ls | grep wp-config wp-config-sample.php [root@adamhuanlinux wordpress]# cp wp-config-sample.php wp-config.php [root@adamhuanlinux wordpress]# |
编辑wp-config.php的内容:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
<?php /** * WordPress基础配置文件。 * * 本文件包含以下配置选项:MySQL设置、数据库表名前缀、密钥、 * WordPress语言设定以及ABSPATH。如需更多信息,请访问 * {@link http://codex.wordpress.org/zh-cn:%E7%BC%96%E8%BE%91_wp-config.php * 编辑wp-config.php}Codex页面。MySQL设置具体信息请咨询您的空间提供商。 * * 这个文件被安装程序用于自动生成wp-config.php配置文件, * 您可以手动复制这个文件,并重命名为“wp-config.php”,然后填入相关信息。 * * @package WordPress */ // ** MySQL 设置 - 具体信息来自您正在使用的主机 ** // /** WordPress数据库的名称 */ define('DB_NAME', 'wordpress_data'); /** MySQL数据库用户名 */ define('DB_USER', 'wordpress_admin'); /** MySQL数据库密码 */ define('DB_PASSWORD', '*******'); /** MySQL主机 */ define('DB_HOST', 'localhost'); /** 创建数据表时默认的文字编码 */ define('DB_CHARSET', 'utf8'); /** 数据库整理类型。如不确定请勿更改 */ define('DB_COLLATE', ''); |