文章目录
配置环境
服务端 | 192.168.162.20 |
---|---|
客户端 | 192.168.162.5 |
这两台机器上都要布置docker基本环境
LNMP环境安装
手动创建nginx yum安装源
[root@localhost ~]# vim /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1
安装nginx
[root@localhost ~]# yum install nginx -y
开启nginx服务
[root@localhost ~]# systemctl start nginx
[root@localhost ~]# netstat -ntap | grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 108485/nginx: maste
[root@localhost ~]# systemctl enable nginx #设为开机自启动
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.
配置结束后访问nginx网页
安装mysql 5.7
yum install -y mariadb-server mariadb
systemctl start mariadb.service
systemctl enable mariadb.service
mysql_secure_installation #进行设置
[root@localhost ~] # mysql -uroot -p
安装PHP 7.2
[root@localhost ~]# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum仓库建立
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum install -y php72w php72w-devel php72w-fpm php72w-gd php72w-mbstring php72w-mysql #安装软件包
php -v #查看PHP版本
配置nginx支持php
(1)修改php-fpm配置文件,把apache改为nginx
[root@localhost ~]# vim /etc/php-fpm.d/www.conf
#第8行 user = nginx
#第10行 group = nginx
配置location,在index中添加index.php。以支持index.php的首页
[root@localhost ~]# vim /etc/nginx/conf.d/default.conf
#第10行 index index.php index.html index.htm;
#第30~36行
#配置php请求被传送到后端的php-fpm模块,