配置文件更改如下:
| # Firewall configuration written by system-config-firewall # Manual customization of this file is not recommended. *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT //下面是编辑添加的部分 -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT //以上是编辑添加的部分 -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited COMMIT |
然后输入:wq保存退出,在命令窗口输入以下命令使其生效:
| systemctl restart iptables.service #最后重启防火墙使配置生效 systemctl enable iptables.service #设置防火墙开机启动 |
2、关闭SELINUX
命令行输入以下内容,打开selinux配置文件:
| sudo vi /etc/selinux/config |
修改内容如下
| #SELINUX=enforcing #注释掉 #SELINUXTYPE=targeted #注释掉 SELINUX=disabled #增加 |
输入:wq!#保存退出,然后命令行输入以下内容,使其生效
| setenforce 0 #使配置立即生效 |
2.安装PHP
yum默认安装的php版本较低,这次,我们准备安装php5.6版本,所以需要先安装epel库,然后安装php。
| yum install epel-release rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm yum install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-fpm php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof |
安装完成后键入php -v会显示出php的版本,代表我们php安装完成了。
| php -v |

3.安装nginx
然后启动nginx
| systemctl start nginx.service #启动nginx systemctl stop nginx.service #停止 systemctl restart nginx.service #重启 systemctl enable nginx.service #设置开机启动 |
.更改nginx端口号(根据自己需求)
cd /etc/nginx/conf.d/
vim default.conf
把listen 80改成listen 81
然后重启nginx
systemctl restart nginx.service #重启nginx

这时我们打开浏览器,访问localhost如果出现Welcome to nginx!那么nginx就安装成功了








