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.

相关文章:

  • 2022-12-23
  • 2021-07-01
  • 2021-07-18
  • 2021-09-26
  • 2021-12-15
  • 2021-06-13
  • 2021-08-19
  • 2021-06-11
猜你喜欢
  • 2022-01-09
  • 2021-07-22
  • 2022-12-23
  • 2022-12-23
  • 2021-11-15
  • 2021-12-01
相关资源
相似解决方案