Nginx loaction Configuration and Tomcat deployment mode Tomcat deployment Tomcat using Tomcat

Source: Internet
Author: User
Yesterday wrote a servlet, debugging the process learned a lot of things.

First, the front end is separate from the server. The front-end project is placed in Nginx, and HTTP requests are forwarded via Nginx. One

action= '/ka_upload ' of the form, configured in Nginx conf to

Location/ka_ {     Proxy_pass http://localhost:8080/kmgw/access/post;     Proxy_redirect default;     # Other Ellipsis}
Through Firebug discovery, Http://localost:80/ka_upload has been 404. Http://localost:80/ka_upload indicates that Nginx has received the request, the location of the Ka_ is automatically appended to the upload. Does it not go to the URL of Proxy_pass? In fact it should be also put upload appended to the back of Proxy_pass, equivalent to Http://localhost/kmgw/access/postupload, which is of course 404.

The first method, loaction changes to/ka_upload, exactly matches to (can be added =). The second is to make the URL of the app to be forwarded the same as loaction, such as ensuring that http://localhost:8080/kmgw/ka_upload is correctly accessible.

Nginx configuration There are many, temporarily not one by one familiar.

Tomcat had always thought that to run the project, it had to be placed under the WebApp, but there were other ways.

1. Pack into a war and copy it to the tomcat/webapp/directory

This way, when Tomcat starts, it will be automatically extracted to the same name directory, access path with the directory name can be

2. Modify Conf/server.xml

Modify Conf/server.xml, find this configuration inside

 
   
Increase in the inside configuration, which adds a Web application, such as:

p> here, if the path is empty, you can access it directly through the domain name. Write path= "specific value", then add the project name, http://localhost:8080/the specific value/... It is known that this configuration is not recommended

3. Do not modify Server.xml "recommended this method"

 conf" Catalina "localhost in the Tomcat folder (for TOMCAT6 version and above, you need to create both Catalina and localhost folders ) to create a new XML file. The content is!--? XML version= "1.0" encoding= "UTF-8"?--> 
     
     note that this way, the configuration path=**** is not valid, the path of the specific Web access to the new configuration of the XML file name, such as configured for Kkk.xml, then access to the Web application needs to/kkk/
reference Http://blog.csdn.net/lawmansoft /article/details/7394331

Above describes the Nginx loaction configuration and the Tomcat deployment method, including the tomcat,action aspect of the content, I hope to be interested in PHP tutorial friends helpful.

  • 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.