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?

王林
Release: 2020-05-23 10:50:23
Original
2952 people have browsed it

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
Copy after login

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template