Home>Article>Operation and Maintenance> What should I do if httpd cannot be accessed under centos7?
Problem description:
Apache (httpd) is installed on CentOS 7 in the virtual machine, but the virtual machine cannot be accessed from the host.
Analysis:
Firewall problem
Solution:
Run the following command to set tcp port 80 to allow any IP to access.
[root@localhost ~]# iptables -I INPUT -p TCP --dport 80 -j ACCEPT
If you want to set other ports to allow any IP to access, just change 80 in the above command to other ports.
Note: This method is temporary and must be executed again after restarting.
If you are just learning for yourself, you can turn off the firewall firewall. The method is as follows (only applicable to CentOS 7):
#停止firewall systemctl stop firewalld.service #禁止firewall开机启动 systemctl disable firewalld.service
Recommended tutorial:centos tutorial
The above is the detailed content of What should I do if httpd cannot be accessed under centos7?. For more information, please follow other related articles on the PHP Chinese website!