今天给一个学校安装nginx设置开机启动,对方的操作系统是centos7的。但是后来发现开机并没有启动,而且iptables里的设置也没有生效。随便一百度,人家就甩出解决方案了。我就整理总结一下,自己做个备忘吧。


先在/etc/sysconfig/iptables里写好规则,然后就是下面这堆了:

#!/bin/bash

chmod +x /etc/rc.d/rc.local

systemctl stop firewalld

systemctl disable firewalld

systemctl restart iptables

systemctl enable iptables


没有找到iptables服务的,执行yum install -y iptables-services