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

王林
Release: 2020-05-19 10:42:34
Original
2770 people have browsed it

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

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

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!

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