zoukankan      html  css  js  c++  java
  • Nginx proxying for Tomcat applications

    As Tomcat is not a true web server, it's worth to use it as backend. Nginx is one of the best solutions for the frontend web server.

    So, after a typical XWiki installation we have XWiki running on http://localhost:8080/xwiki. Most probably, we want to access XWiki viahttp://mydomain.com on standard 80 port. Tuning Nginx will give us the desired result:

    • create this file /etc/nginx/conf.d/tomcat.conf
    • put the following code inside:
      server {
          listen       80;
          server_name  mydomain.com;
      # Root to the XWiki application
          root  opt/tomcat/webapps/xwiki;

          location / {
      #All "root" requests will have /xwiki appended AND redirected to mydomain.com again
              rewrite ^ $scheme://$server_name/xwiki$request_uri? permanent;
          }

          location ^~ /xwiki {
      # If path starts with /xwiki - then redirect to backend: XWiki application in Tomcat
             proxy_pass http://localhost:8080/xwiki;

          }
      }
    • restart nginx

    Now all http://mydomain.com/* requests will lead to the XWiki application. Please note that these settings are basic. For more flexible solutions please refer to the Nginx documentation.

  • 相关阅读:
    深度学习中的基本概念——梯度相关
    模型训练中涉及到的技巧
    ubuntu swapfile
    ubuntu install opencv
    Jetson TX1 安装ROS操作系统
    Redis介绍以及安装(Linux)
    C# url信息获取
    贝茨视觉训练法
    PHP设计模式浅析
    MySQL相关知识
  • 原文地址:https://www.cnblogs.com/zhangqingsh/p/2976118.html
Copyright © 2011-2022 走看看