nginx + tomcat 配置,靜態資源直接使用nginx myeclipse tomcat配置 tomcat 下載 eclipse配置tomcat

來源:互聯網
上載者:User
Java代碼

  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 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)$ #設定訪問靜態檔案直接讀取不經過tomcat
  22. {
  23. expires 30d;
  24. }
  25. location ~ ^/(WEB-INF)/ { #這個很重要,不然使用者就可以訪問了
  26. deny all;
  27. }
  28. error_page 500 502 503 504 /50x.html;
  29. location = /50x.html {
  30. root html;
  31. }
  32. }

以上就介紹了nginx + tomcat 配置,靜態資源直接使用nginx,包括了tomcat 配置方面的內容,希望對PHP教程有興趣的朋友有所協助。

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    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.