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

**URL:** <https://www.ruby-forum.com/t/need-example-of-nginx-conf-for-tomcat-6-running-alfresco/188062>\
**Category:** NGINX\
**Created:** [May 5, 2010, 6:46am UTC](https://www.ruby-forum.com/t/need-example-of-nginx-conf-for-tomcat-6-running-alfresco/188062 "2010-05-05T06:46:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stefans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9d8465/32.png) [@stefans](https://www.ruby-forum.com/u/stefans)\
**Post date:** [May 5, 2010, 6:46am UTC](https://www.ruby-forum.com/t/need-example-of-nginx-conf-for-tomcat-6-running-alfresco/188062/1 "2010-05-05T06:46:17Z")

</div>

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/alfresco)  
[http://myserver.com:8080/share](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](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](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!

---

<div class="post-metadata">

**Author:** ![stefans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9d8465/32.png) [@stefans](https://www.ruby-forum.com/u/stefans)\
**Post date:** [May 5, 2010, 2:44pm UTC](https://www.ruby-forum.com/t/need-example-of-nginx-conf-for-tomcat-6-running-alfresco/188062/2 "2010-05-05T14:44:12Z")

</div>

On Tue, May 4, 2010 at 11:46 PM, Stefan S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
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

---

<div class="post-metadata">

**Author:** ![stefans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9d8465/32.png) [@stefans](https://www.ruby-forum.com/u/stefans)\
**Post date:** [May 14, 2010, 7:47am UTC](https://www.ruby-forum.com/t/need-example-of-nginx-conf-for-tomcat-6-running-alfresco/188062/3 "2010-05-14T07:47:40Z")

</div>

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.
