Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm dropping Apache as a reverse proxy to a Tomcat instance, mainly because it has no other purpose other than forwarding requests to the Tomcat instance.

I'm no expert at deploying Java Web applications with Tomcat and I'm wondering if I'm running in for a nasty surprise if I use Nginx to forward requests to the HTTP connector?

share|improve this question
up vote 1 down vote accepted

Yeah, that'll work just fine.

From the tag, I'm guessing you're using an AJP connector right now? You'll just need to make sure that your HTTP listener is working right; otherwise, there should be no problem. Nginx works great as a reverse proxy.

share|improve this answer
Yeah, your right, thanks. I was previously communicating via AJP and I had concerns about sessions and response headers, but everything seems to be working fine--faster even! – Filip Dupanović Apr 8 '11 at 8:48

Shouldn't run into any problems. I have that setup right now. Here's a modified version nginx conf that shows it's pretty straightforward.

server {
        listen      80;
        rewrite     ^(.*)   https://$server_name$1 permanent;

server {
        listen   443;

        server_name server;

        ssl  on;
        ssl_certificate  /certs/ssl.crt;
        ssl_certificate_key  /certs/ssl.key;

        ssl_session_timeout  5m;

        ssl_protocols  SSLv2 SSLv3 TLSv1;
        ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
        ssl_prefer_server_ciphers   on;

        access_log  /var/log/nginx/access.log;

        location / {
            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;

            client_max_body_size       10m;
            client_body_buffer_size    128k;

            proxy_connect_timeout      90;
            proxy_send_timeout         90;
            proxy_read_timeout         90;

            proxy_buffer_size          4k;
            proxy_buffers              4 32k;
            proxy_busy_buffers_size    64k;
            proxy_temp_file_write_size 64k;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.