Nginx as a proxy for tomcat with subdirectory

I think you added something / extra in your config settings...

Look at this line:

proxy_pass http://IP_ADD_TOMCAT_SERVER:8080/;

you need to remove the trailing slash and it should work fine.

like this:

proxy_pass http://IP_ADD_TOMCAT_SERVER:8080;

try it out and see if things go fine!!

Update#1 I just noticed that you have another mistake "same typo" in your location /

remove the 2nd slash and it should work fine!!

like this : location /demo { instead of this location /demo/ {

Update #1: you can test your url using this

$ curl -I http://yoururl.com

and see what result gives you. this way you know if it is working or not.

Update #3:

your setting to work with any .jsp extension should have this code in your vhost:

location ~ \.jsp$ {
    proxy_pass              http://localhost:8080;
    proxy_set_header        X-Real-IP $remote_addr;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header        Host $http_host;
  }

also to get /demo to work , you need to add rewrite code below server_name example.com

rewrite ^/(.*)$ /demo/$1;