Home > Backend Development > PHP Tutorial > Win7 host accesses tomcat and nginx of Linux virtual machine

Win7 host accesses tomcat and nginx of Linux virtual machine

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-29 09:12:49
Original
1176 people have browsed it

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:

win7宿主机访问linux 虚拟机的tomcat、nginx

Click "Add..."

win7宿主机访问linux 虚拟机的tomcat、nginx

Add which port on the host you want to forward to which service port on the virtual machine, as shown in the picture :

win7宿主机访问linux 虚拟机的tomcat、nginx

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.

Related labels:
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