搭建lnmp平台
1、安装Nginx(192.168.8.10):
使用Nginx官方提供的rpm包
vim /etc/yum.repos.d/nginx.repo [nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/7/$basearch/ gpgcheck=0 enabled=1
执行yum安装
yum install nginx -y systemctl start nginx systemctl enable nginx
2、使用第三方扩展epel源安装PHP7:
第一种方法:
rpm -Uvh epel-release rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm yum install -y php72w php72w-opcache php72w-xml php72w-mcrypt php72w-gd php72w-devel \ php72w-mysql php72w-intl php72w-mbstring systemctl start php-fpm
第二种方法:
yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
安装 php73 版本
yum -y install php73-php-fpm php73-php-cli php73-php-bcmath php73-php-gd \ php73-php-json php73-php-mbstring php73-php-mcrypt php73-php-mysqlnd \ php73-php-opcache php73-php-pdo php73-php-pecl-crypto php73-php-pecl-mcrypt \ php73-php-pecl-geoip php73-php-recode php73-php-snmp php73-php-soap php73-php-xmll
启动 php
systemctl restart php73-php-fpm
注:因为网速问题,直接复制php-rpm包本地安装
cd php-rpm yum -y localinstall *.rpm systemctl start php-fpm systemctl enable php-fpm
3、安装mysql(mariadb):
rpm -ivh http://repo.mysql.com/yum/mysql-5.6-community/el/7/x86_64/mysql-community-release-el7-5.noarch.rpm yum install mysql-community-server -y systemctl start mysqld systemctl enable mysqld 修改mysql密码:mysql_secure_installation
4.应用1:搭建wordpress
(1)下载wordpress源码包
(2)复制wordpress安装包,到虚拟机/,解压并赋权
unzip wordpress-4.9.4-zh_CN.zip chmod -R 777 /wordpress
(3)创建虚拟主机配置文件
vim /etc/nginx/conf.d/blog.conf 添加: server { listen 80; server_name blog.benet.com; root /wordpress; index index.php index.html; location ~ \.php$ { root /wordpress; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME documentrootdocument_rootfastcgi_script_name; include fastcgi_params; } } 保存退出 systemctl reload nginx
(4)创建blog数据库和管理用户
登录数据库:
mysql -uroot -p123.com
创建数据库:
create database blog;
设置管理用户及密码:
grant all on blog.* to lisi@localhost identified by '123.com';