首页 > 代码库 > lnmp--搭建wordPress博客程序

lnmp--搭建wordPress博客程序

1.登录MySQL

mysql> create database wordpress;
Query OK, 1 row affected (0.00 sec)

mysql> grant all on wordpress.* to wordpress@‘localhost‘ identified by ‘redhat‘;
Query OK, 0 rows affected (0.08 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql> show grants for wordpress@‘localhost‘;
+------------------------------------------------------------------------------------------------------------------+
| Grants for wordpress@localhost |
+------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO ‘wordpress‘@‘localhost‘ IDENTIFIED BY PASSWORD ‘*84BB5DF4823DA319BBF86C99624479A198E6EEE9‘ |
| GRANT ALL PRIVILEGES ON `wordpress`.* TO ‘wordpress‘@‘localhost‘ |
+------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

mysql> select user,host from mysql.user;
+-----------+-----------+
| user | host |
+-----------+-----------+
| root | 127.0.0.1 |
| root | localhost |
| wordpress | localhost |
+-----------+-----------+
3 rows in set (0.01 sec)

 

[root@lnmp www]# cd /application/nginx/conf/extra/
[root@lnmp extra]# cat www.conf

server {
     listen       80;
     server_name  www.yangyang.com;
     location / {
         root   html/www;
         index  index.php  index.html index.htm;    #index.php补充一个首页文件
     }
	 location ~ .*\.(php|php5)?$ {
		 root html/www;
		 fastcgi_pass 127.0.0.1:9000;
		 fastcgi_index index.php;
		 include fastcgi.conf;
	 }
     access_log logs/access_www.log main;
     }

 

[root@lnmp extra]# /application/nginx/sbin/nginx -t
nginx: the configuration file /application/nginx-1.6.3/conf/nginx.conf syntax is ok
nginx: configuration file /application/nginx-1.6.3/conf/nginx.conf test is successful
[root@lnmp extra]# /application/nginx/sbin/nginx -s reload

 

[root@lnmp www]# tar -xf wordpress-4.7.2-zh_CN.tar.gz
[root@lnmp www]# rm -rf test_info.php index.html #删除无用的文件
[root@lnmp www]# mv wordpress/* ./ #把wordpress文件移动到www目录
[root@lnmp www]# mv wordpress-4.7.2-zh_CN.tar.gz /home/yang/tools/
[root@lnmp www]# chown -R nginx.nginx ../www/ #授权Nginx及php站点目录,这只是临时做法

root@lnmp www]# ll
total 192
-rw-r--r--. 1 nginx nginx 418 Sep 25 2013 index.php
-rw-r--r--. 1 nginx nginx 19935 Jan 3 02:51 license.txt
-rw-r--r--. 1 nginx nginx 6956 Jan 28 08:53 readme.html
drwxr-xr-x. 2 nginx nginx 4096 Mar 2 17:36 wordpress
-rw-r--r--. 1 nginx nginx 5447 Sep 28 05:36 wp-activate.php
drwxr-xr-x. 9 nginx nginx 4096 Jan 28 08:53 wp-admin
-rw-r--r--. 1 nginx nginx 364 Dec 19 2015 wp-blog-header.php
-rw-r--r--. 1 nginx nginx 1627 Aug 29 2016 wp-comments-post.php
-rw-r--r--. 1 nginx nginx 2930 Jan 28 08:53 wp-config-sample.php

lnmp--搭建wordPress博客程序