The local machine cannot access the apache service in the virtual machine, but can ping each other

Solution reference: http://www.linuxidc.com/Linux/2012-06/63848.htm

When I was doing the experiment today, after installing apache on the CentOS6.3 system in the virtual machine, after starting the service, I checked that the service has indeed been turned on, but I cannot access it by entering the IP address of the virtual machine in the local machine, but the local machine and The virtual machines can ping each other. Later, after many searches, I finally found the reason, because the firewall of the Linux system blocked port 80.

After searching for a long time, I finally found a solution:

1. Modify the firewall settings: enter the command /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT under Shell

2. Save the above settings: /etc/rc.d/init.d/iptables saved

3. Restart the firewall: /etc/init.d/iptables restart

Now, enter the IP address of the virtual machine in the browser of the local machine, and access the web server successfully! ! The following is the result of accessing the index.php file

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326574580&siteId=291194637