First of all, let’s emphasize the NAT method of communication between the host and the virtual machine built by VMware.
A rough description of the steps to successfully access the service:
1. Make sure the tomcat or nginx service has been turned on in your virtual machine;
2. Add port forwarding configuration to the virtual machine, go to the vmware menu bar Edit->Virtual Network The editor... A pop-up similar to the picture below:
Click "Add..."
Add which port on the host you want to forward to which service port on the virtual machine, as shown in the picture :
Click OK and it’s basically done.
If you cannot access the port you forwarded locally, analyze the reason:
For example, the port you forwarded is 8000
1. Telnet localhost 8000 on the win7 host. If you can connect, it means there is no problem on win7;
2. Turn off the firewall of your virtual machine in 2 ways:
I) service iptables stop (The characteristic is: it can take effect immediately without restarting the machine, but after turning on the virtual machine again, the firewall is still on)
II )chkconfig iptables off (Characteristics: The machine needs to be restarted to take effect permanently)
If neither of the above two methods works, then try setting your selinux to disabled. The specific method:
First check the selinux status Command:
/usr/sbin/sestatus -v,
If it is enabled, modify the vi /etc/selinux/config file to turn it off:
Find SELINUX=enforcing in the config file and modify it to SELINUX=disabled
Restart the machine, OK.
It took me 2 nights to get it right. It turned out to be the problem with selinux. After setting it to disabled, I successfully accessed it. Haha, I still have to thank you for your help!
The above introduces the tomcat and nginx of the win7 host to access the Linux virtual machine, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.