Welcome! Log In Create A New Profile

Advanced

Tomcat, domains and Nginx

Posted by p0l0 
Tomcat, domains and Nginx
July 19, 2013 09:32AM
Hello,

I have some web apps on my tomcat server
And i have some domains name.


I would like to redirect domain on it web app.


If i'm using

location /app {
proxy_pass http://host/app ;
}

My app works fine


But if i'm using


location / {
proxy_pass http://host/app ;
}


I'm redirecting to
http://host/app/app

And my app does not working.


I have tried to use
proxy_redirect http://host/app /;

and subs_filter

But i have the same problem.


How can i redirect www.mydomain.com to http://tomcat/my_app
and not
http://tomcat/my_app/my_app


My vhost :



server {
listen 80; ## listen for ipv4
server_name mydomain.com;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log debug;

location / {
index index.jsp;
proxy_pass http://proxy/myapp ;
}
}


proxy :

upstream proxy {
sticky name=proxy;
server serveur_ip1:8080;
server serveur_ip2:8080;
}


and

proxy_temp_path /var/cache/nginx;
proxy_ignore_headers Expires Cache-Control;

proxy_buffering on;

proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Url-Scheme $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 120;
proxy_send_timeout 120;
proxy_read_timeout 120;
proxy_buffers 64 32k;
proxy_buffer_size 8k;
proxy_temp_file_write_size 64k;


URL :

http://www.mydomain ( The URL on the browser is updated to http://www.mydomain.com/myapp/ )

Error tomcat :

type Status report

message /myapp/myapp/signin;jsessionid=4A9EA553F908D
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 55
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready