nginx proxy for tomcat 6 with SSL

krish nginx-forum at nginx.us
Tue Dec 7 10:19:44 MSK 2010


Hi,

I am very new to nginx and i need some advice.

I have set up nginx reverse proxy for tomcat 

Client ------> Nginx proxy -----> tomcat

The client uses ssl connection to ngnix and another ssl connection from
there to tomcat server.

My nginx.conf is given below.


[color=#990033]user www-data;
worker_processes  1;
#server_names_hash_bucket_size 32;
error_log  /var/log/nginx/error.log;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {

  geoip_country /etc/nginx/GeoIP.dat;
  geoip_city    /etc/nginx/GeoLiteCity.dat;

default_type application/octet-stream;
server_names_hash_bucket_size 33;

#### Log Format #####
log_format   main '$remote_addr - $remote_user [$time_local]  $status '
        '"$request" $body_bytes_sent "$http_referer" ---
"$request_length"'
        '"$http_user_agent" "$http_x_forwarded_for" -- "$request_uri"'
        '"$geoip_country_code" -- "$geoip_city" -- "$geoip_region" --
"$geoip_postal_code"';


client_header_buffer_size 1k;
large_client_header_buffers 4 1k;

    server {

      server_name emr.spectramedi.com www.emr.spectramedi.com;
      listen 192.168.25.93:443;

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

### SSL Configurations ###
      ssl on;
      ssl_certificate /etc/nginx/emr_spectramedi_com.crt;
      ssl_certificate_key /etc/nginx/emr.key;

### Reject requests for Uri with more than 100 characters###
if ($request_uri ~ '.{100}') {
return 444;
}
### Reject requests for Uri with '.' & '?' ####
if ($request_uri ~ '[\.\?]') {
return 444;
}

  client_max_body_size 30M;
  client_body_buffer_size 128k;
  proxy_set_header X-Real-IP $remote_addr;                     
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

location / {


           proxy_pass   https://10.10.1.2/manager/html/;
           proxy_redirect off;

}
}
}[/color]

I need tomcat's manager application to be loaded when the client
connects to the site. So i have made
 
[b]proxy_pass   https://10.10.1.2/manager/html/;[/b]

After making this change i get the tomcat manager page as default, which
is fine. 
But when i try to access the link for  [color=#000066]Server status
page[/color], 
it shows the following error :-

[b]FAIL - Unknown command /manager/status[/b]

This error was not there when i used  proxy_pass   https://10.10.1.2/;
in nginx.conf

please help

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,156318,156318#msg-156318




More information about the nginx mailing list