1. 关闭防火墙和selinux
打开文件selinux
vim /etc/sysconfig/selinux
- 1
将文件中SELINUX=enforcing改为disabled,然后执行”setenforce 0″不用重启地关闭selinux。
SELINUX=disabled
systemctl stop firewalld.service
- 1
2.安装软件
2.1.MysqL安装
下载MysqL的repo源
wget http://repo.MysqL.com/MysqL-community-release-el7-5.noarch.rpm
rpm -ivh MysqL-community-release-el7-5.noarch.rpm
sudo yum install -y MysqL-server
sudo chown -R root:root /var/lib/MysqL
-
@H_502_20@ 重启服务:
systemctl restart MysqL.service
MysqL -u root
MysqL > use MysqL;
MysqL > update user set password=password(‘123456‘) where user=‘root‘;
MysqL > flush privilgegs;
MysqL > exit;
- 1
- 2
- 3
- 4
- 5
2.2Nginx安装
下载对应当前系统版本的Nginx包
wget http://Nginx.org/packages/centos/7/noarch/RPMS/Nginx-release-centos-7-0.el7.ngx.noarch.rpm
rpm -ivh Nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum install -y Nginx
systemctl start Nginx.service
- 1
2.3安装PHP
rpm 安装 PHP7 相应的 yum源
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
- 2
安装PHP7.0
yum install -y PHP70w
yum install -y PHP70w-MysqL.x86_64 PHP70w-gd.x86_64 PHP70w-ldap.x86_64 PHP70w-mbstring.x86_64 PHP70w-mcrypt.x86_64
yum install -y PHP70w-fpm
vim /etc/Nginx/conf.d/default.conf
root /forest/NginxDir/html;
location ~.PHP$ {
root /forest/NginxDir/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.PHP;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
- 5
- 6
- 7
3.2 修改PHP-fpm配置文件
PHP-fpm配置文件位置:(/etc/PHP-fpm.d/www.conf)
修改
user =Nginx group=Nginx
- 2
4.放入测试文件
cd /forest/NginxDir/html
echo 'hello eric' >index.PHP
systemctl start Nginx.service
-
@H_502_20@ 查看启动状态:
systemctl status Nginx
-
@H_502_20@看到以下字眼说明启动成功!
Active: active (running) since 六 2016-11-19 13:40:04 CST; 50min ago
5.2.启动PHP-FPM:
systemctl start PHP-fpm.service
-
@H_502_20@ 查看启动状态:
systemctl status PHP-fpm.service
-
@H_502_20@看到以下字眼说明启动成功!Active: active (running) since 六 2016-11-19 14:14:33 CST; 18min ago