LNMP环境准备
1.登录数据库创建用于存储数据库的wordpress库,存储博客数据 mysql> create database wordpress; Query OK, 1 row affected (0.00 sec) mysql> show databases like "wordpress"; +----------------------+ | Database (wordpress) | +----------------------+ | wordpress | +----------------------+ 1 row in set (0.01 sec) 2.创建专用于wordpress的数据库用户 mysql> grant all on wordpress.* to wordpress@'localhost' identified by '123456'; Query OK, 0 rows affected, 1 warning (0.00 sec) 3.刷新权限表 mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) 4.查询用户信息 mysql> select user,authentication_string,host from mysql.user; +---------------+-------------------------------------------+-----------+ | user | authentication_string | host | +---------------+-------------------------------------------+-----------+ | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | localhost | | mysql.session | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | localhost | | mysql.sys | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | localhost | | wordpress | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | localhost | +---------------+-------------------------------------------+-----------+ 4 rows in set (0.00 sec) 5.nginx配置,选择blog虚拟主机配置,添加一个index.php参数 [root@junwu_server extra]# cat /opt/nginx/conf/extra/03_blog.conf server { listen 80; server_name blog.com; location / { root html/blog; index index.html; } #添加有关php程序的解析 location ~ .*\.(php|php5)?$ { root html/blog; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; } }
Wordpress博客程序准备
1.下载获取wordpress程序 wget https://wordpress.org/latest.zip wget https://wordpress.org/latest.tar.gz 2.解压缩zip版代码 [root@junwu_server opt]# yum install unzip -y [root@junwu_server opt]# unzip latest.zip 3.移动worpress代码到nginx目录下,且授权 [root@junwu_server opt]# mv wordpress/ /opt/nginx/html/blog/ [root@junwu_server opt]# cd /opt/nginx/html/blog/ [root@junwu_server blog]# ls test_mysql.php wordpress [root@junwu_server blog]# chown -R nginx.nginx ../blog/ 4.注意别忘记重启nginx [root@junwu_server blog]# nginx -s reload
标签:LNMP,博客,server,blog,nginx,开源,wordpress,mysql,root From: https://www.cnblogs.com/junwured/p/17386843.html