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

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

王林
王林Original
2020-05-23 10:50:232956browse

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

Problem description:

The Apache (httpd) installed on CentOS 7 in the virtual machine cannot be accessed from the host when accessing the virtual machine.

Solution:

You can directly 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

Then you can access it normally on the host.

Note: You have to re-execute this method after restarting.

If we are just learning to use it ourselves, we can completely turn off the firewall. The specific command (only applicable to CentOS 7) is as follows:

#停止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 centos?. 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