First of all, a simple personal understanding of nginx, in fact, Tomcat itself can complete the deployment of Web engineering, so Nginx is actually acting as a proxy server, Nginx listening port (for example, 80) to send received requests to localhost : 8080, and the latter is the Tomcat address. After Tomcat finishes processing the request, it returns to the client after Nginx.
Next, install the Nginx,tomcat,mysql, the tutorials are available online.
To modify the Nginx configuration file, the main code is as follows:
Listen ;
server_name localhost:8080;
#charset Koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
Location/{
proxy_pass http://localhost:8080;
}
The main thing is to modify the server_name, let it point to Tomcat, modify the location, and point it to Tomcat.
Tomcat configuration files can be made without any modifications.
At this point, we visit the HTTP://IP address/And we find that we have jumped to the Tomcat page. Indicates that the environment of Nginx and Tomcat is ready. It should be noted that changes to the Nginx or Tomcat configuration file require that the service be restarted before it takes effect.
At this point, we simply upload the generated Web project's war file directly under Tomcat's specified path, under WebApps, where Tomcat automatically unpack the war package. If not, restart the Tomcat service is OK.
At this point, the deployment is complete.
So nginx whether it is optional. In the above is not reflected, however, if we specify a different interface, such as we have increased the 82 of the listening, and the correct configuration good nginx. Then we can think of a more virtual host. And the resources of the virtual host can be completely independent from the previous one.
Reference Blog: http://cxshun.iteye.com/blog/1535188