Home>Article>Operation and Maintenance> What should I do if httpd cannot be accessed under centos7?

What should I do if httpd cannot be accessed under centos7?

王林
王林 Original
2020-05-19 10:42:34 2714browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn