Nginx with Tomcat to deploy Web engineering __web

Source: Internet
Author: User

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

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.