Nginx + tomcat configuration. for static resources, use nginxmy‑setomcat to configure tomcat and download eclipse to configure tomcat.

Source: Internet
Author: User
Tomcat configuration: nginx + tomcat configuration. for static resources, use nginx: Java code upstreamtomcat_server {server127.0.0.1: 8080;} server {listen80; server_namelocalhost; rootD: workmy-project; Java code

  1. Upstream tomcat_server {
  2. Server 127.0.0.1: 8080;
  3. }
  4. Server {
  5. Listen 80;
  6. Server_name localhost;
  7. Root D: \ work \ my-project;
  8. Location /{
  9. Index. jsp;
  10. }
  11. Location/j_spring_security_check {
  12. Proxy_set_header Host $ host;
  13. Proxy_set_header X-Forwarded-For $ remote_addr;
  14. Proxy_pass http: // tomcat_server;
  15. }
  16. Location ~ . * \. (Jsp | do) $ {
  17. Proxy_set_header Host $ host;
  18. Proxy_set_header X-Forwarded-For $ remote_addr;
  19. Proxy_pass http: // tomcat_server;
  20. }
  21. Location ~ . * \. (Gif | jpg | jpeg | png | bmp | swf | js | css | html) $ # set to directly read static files without passing through tomcat
  22. {
  23. Expires 30d;
  24. }
  25. Location ~ ^/(WEB-INF)/{# This is very important, or the user can access it
  26. Deny all;
  27. }
  28. Error_page 500 502 503 x.html;
  29. Location =/50x.html {
  30. Root html;
  31. }
  32. }

The above describes the nginx + tomcat configuration and the direct use of nginx for static resources, including the tomcat configuration content. if you are interested in the PHP Tutorial, please help.

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.