Need example of nginx.conf for Tomcat 6 (running Alfresco)

Hi -

I have recently installed Alfresco on my server, using Tomcat (no
Apache), and I’m able to access Alfresco as follows WITHOUT using nginx:

http://myserver.com:8080/alfresco
http://myserver.com:8080/share

Now, of course, I would like to access Alfresco 3.3 Community Edition
using Tomcat 6, with nginx as the front-end proxy.

I can’t figure out how to set up my file nginx.conf correctly!

Currently, I have a section as follows in my nginx.conf file:

server {
listen 80;
server_name .portal1.myserver.com;
root /opt/Alfresco/tomcat/webapps/alfresco/;

access_log off;
rewrite_log on;

location / {
proxy_pass http://127.0.0.1:8080;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}

I also did chmod 755 on all files in directory
/opt/Alfresco/tomcat/webapps/alfresco to make sure they’re
world-executable.

But, when I point my browser to http://portal1.myserver.com it returns
“HTTP 400 - bad request”.

Does anyone know how I should set up nginx.conf so that nginx will work
as a front-end proxy for Tomcat/Alfresco?

Thanks!

On Tue, May 4, 2010 at 11:46 PM, Stefan S. [email protected]
wrote:

Hi -

I have recently installed Alfresco on my server, using Tomcat (no
Apache), and I’m able to access Alfresco as follows WITHOUT using nginx:

Try commenting out “proxy_redirect off;” which would leave you with
the implicit behavior “prxoy_redirect default;”. We have tomcat-based
applications (not Alfresco) that use the full URL including host name
for generating redirects at login instead of relative redirects. So
you need to pass in the full host name (which you’re doing correctly
with “proxy_set_header Host $host;”), but the back-end also does
redirects for setting cookies. Not sure if this applies to Alfresco,
but it is worth a try.

A tool like Fiddler might also help you see what’s going on.


RPM

Ryan M. wrote:

Try commenting out “proxy_redirect off;” which would leave you with
the implicit behavior “prxoy_redirect default;”.
A tool like Fiddler might also help you see what’s going on.
RPM

Thank you. I will give this a try.