我安装了最小化配置的CentOS 7(只包括操作系统和开发工具)。 我试图为httpd
服务打开80端口,但我的iptables服务出了些问题...这是什么问题?我做错了什么?
# ifconfig/sbin/service iptables save
bash: ifconfig/sbin/service: No such file or directory
# /sbin/service iptables save
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.
# sudo service iptables status
Redirecting to /bin/systemctl status iptables.service
iptables.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
# /sbin/service iptables save
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.
# sudo service iptables start
Redirecting to /bin/systemctl start iptables.service
Failed to issue method call: Unit iptables.service failed to load: No such file or directory.
sudo yum install -y firewalld && sudo systemctl start firewalld
。然后添加HTTP服务sudo firewall-cmd --permanent --add-service=http
(如果需要打开443端口,则还需添加_https_服务)。最后将新配置加载到firewalld中sudo firewall-cmd --reload
。 - Takman