maandag 16 juli 2012

Install nginx on ubuntu 12.04 and connect it to Tomcat


First install nginx like stated here.
  • sudo apt-get install nginx
  • sudo service nginx start
Next, configure nginx to connect to Tomcat like specified here and here

server {
    listen 80;
    server_name hostname.org;

    location / {
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://127.0.0.1:8080/;
    }
}

These two blogs do not mention the fact you'll have to tell tomcat you're using a proxy. So in [tomcat-home]/conf/server.xml make sure the Connector has a proxyName and proxyPort.
  • <Connector port="8080" protocol="HTTP/1.1" proxyPort="80" proxyName="hostname.org" ..... />
If you run into the problem that the browser got too many redirects then first make sure the Home URL in the Portal Settings is set to something useful. This can also be done in the portal-ext.properties file.
  • company.default.home.url=/web/guest/home



Geen opmerkingen:

Een reactie posten