标签:lnpm
实验目标:搭建lnmp并实现wordpress,phpmyadmin功能,并为phpmyadmin添加https服务
实验环境:centos7,使用epel源安装nginx,php,php-fpm,mariadb,pgp-mysql, php-mbstring
修改hosts文件,添加一条记录
[root@localhost php-fpm.d]# vim /etc/hosts
172.16.34.2 www.pma.com www.wp.com
对nginx进行配置
切换至nginx配置文件目录,将配置文件中的server内容注释,在http上下文中添加index的默认查看选项
[root@localhost phpMyAdmin]# cd /etc/nginx
[root@localhost nginx]# vim nginx.conf
index index.php index.html index.htm;
切换至conf.d目录
[root@localhost nginx]# cd conf.d/
创建wp.conf配置文件
[root@localhost conf.d]# vim wp.conf
server {
listen80;
server_namewww.wp.com;
root/wp/wordpress;
location ~ \.php$ {
fastcgi_pass 172.16.34.2:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /wp/wordpress/$fastcgi_script_name;
include fastcgi_params;
}
}
创建phpmyadmin配置文件
[root@localhost conf.d]# vim pma.conf
server {
listen80;
server_namewww.pma.com;
root/pma/pma;
location ~ \.php$ {
fastcgi_pass 172.16.34.2:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /pma/pma/$fastcgi_script_name;
include fastcgi_params;
}
}
配置php-fpm,添加当前主机IP地址
[root@localhost ~]# cd /etc/php-fpm.d/
[root@localhost php-fpm.d]# vim www.conf
listen = 172.16.34.2:9000
listen.allowed_clients = 172.16.34.2
配置mariadb
创建wordpress用的数据库及账号密码
MariaDB [(none)]> create userwpuser@‘172.16.%.%‘ identified by ‘wppass‘;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> create database wpdb;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all on wpdb.*to wpuser@‘172.16.%.%‘ identified by‘wppass‘;
Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
创建phpmyadmin用账号密码
MariaDB [(none)]> create userpma@‘172.16.%.%‘ identified by ‘pmapass‘;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all on *.*to pma@‘172.16.%.%‘ identified by‘pmapass‘;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
安装wordpress
使用wordpress的压缩包,将复制至服务器,此处使用/wp目录
[root@localhost ~]# mkdir /wp
[root@localhost ~]# cd /wp
[root@localhost wp]# unzipwordpress-4.5.3-zh_CN.zip
[root@localhost wp]# cd wordpress/
修改配置文件中数据库地址
[root@localhost wordpress]# mvwp-config-sample.php wp-config.php
[root@localhost wordpress]# vimwp-config.php
// ** MySQL 设置 - 具体信息来自您正在使用的主机 ** //
/** WordPress数据库的名称*/
define(‘DB_NAME‘, ‘wpdb‘);
/** MySQL数据库用户名 */
define(‘DB_USER‘, ‘wpuser‘);
/** MySQL数据库密码 */
define(‘DB_PASSWORD‘, ‘wppass‘);
/** MySQL主机 */
define(‘DB_HOST‘, ‘172.16.34.2‘);
验证登录
配置phpmyadmin
使用phpmyadmin的压缩包,将复制至服务器,此处使用/pma目录
[root@localhost ~]# mkdir /pma
[root@localhost ~]# cd /pma
[root@localhost pma]# unzipphpMyAdmin-4.4.14.1-all-languages.zip
给解压的文件夹做一个软连接
[root@localhost pma]# ln -sphpMyAdmin-4.4.14.1-all-languages pma
编辑phpmyadmin的配置文件
[root@localhost pma]# mvconfig.sample.inc.php config.inc.php
[root@localhost pma]# vim config.inc.php
$cfg[‘Servers‘][$i][‘host‘] =‘172.16.34.2‘;
登录验证
使用lnmp实现wopdpress,phpmyadmin服务,并为phpmyadmin提供https服务
标签:lnpm
原文地址:http://mylinuxlearn.blog.51cto.com/9740653/1831817