Is it possible to make NGINX work with Liferay on Tomcat using http and https? Is it possible to make NGINX work with Liferay on Tomcat using http and https? nginx nginx

Is it possible to make NGINX work with Liferay on Tomcat using http and https?


That is not the recommended way to do this. If you have a proxy like NGINX (in my case pound) then the SSL layer should be left up to the proxy. This allows the proxy to examine the HTTP headers to provide 'sticky' sessions where a user stays on a single tomcat web server out of the cluster.

In my case I get tomcat to listen on localhost:8080Pound listens on external ip:80 and only returns a redirect to https (external ip:443)Pound also listens on external ip:443, decrypts the SSL and proxies to tomcat on 8080 (actually a cluster of tomcats)

You also need to set some params in portal-ext.properties:
web.server.http.port=80
web.server.https.port=443
web.server.protocol=https

This tells LifeRay to generate all links as HTTPS on port 443 which matches the public interface of the SSL proxy.

Now the problem is that if you connect directly to tomcat on 8080 LifeRay will generate 'wrong' links and send you off to the proxy. I still haven't found a way to get around this.


Using nginx as a reverse proxy for your tomcat installation is possible with these lines of code in your nginx site configuration.

server {  listen 80;  server_name my.server.com;  location / {    proxy_set_header        X-Real-IP $remote_addr;    proxy_set_header        Host    $http_host;    proxy_pass              http://127.0.0.1:8080;  }}

This allows you to set up another virtual host (server_name) on nginx, forwarding to your tomcat installation at http://127.0.0.1:8080. Add SSL/TLS support here, not in tomcat configuration.

I have not checked webdav, but using the portal with a webbrowser works like a charm.