Solution to failure of accessing the web server of a virtual machine from a local machine

Source: Internet
Author: User

The local machine fails to access the web server of the virtual machine. a lamp is set up in the virtual machine at noon, and the browser of the host machine is used to access the web server of the virtual machine, but the access fails, again, I checked the local machine and Virtual Machine and found that the situation was like this:
1. host Machine can ping the Virtual Machine 2. the virtual machine can ping the host machine. 3. virtual machines can access web servers through http: // localhost. 4. the host machine cannot access the web server through a browser
First, I telnet the VM's window 80 in the dos window of the host machine, but failed. It can be determined that there is a problem with the VM's window 80, which should be blocked by the firewall. Www.2cto.com has been searching for a long time and finally found a solution:
1. modify firewall settings: Enter the command/sbin/iptables-I INPUT-p tcp -- dport 80-j accept2in Shell to save the above settings:/etc/rc. d/init. d/iptables saved3. restart the firewall:/etc/init. d/iptables restart: Enter the IP address of the VM in the local browser. The web server is successfully accessed !! The following are the results of accessing the index. php file.

Prepared by AI_Net

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.