Right now I have my website running on tomcat, www.domain:11000/projectName, I am trying to map when the user enters www.domain:10000 (would do port 80 but my ISP blocks port 80 so I use port forwarding 10000-->80) I created a new site in my site-available with the code:

server{ location / { include /etc/nginx/conf.d/proxy.conf; } }

and inside the proxy.conf file i have:

proxy_set_header Host $host:11000/*projectName*; 

When I try to access the site now it just gives me a 404.

What am I doing wrong? and what can I do to make it work.

link|improve this question
feedback

1 Answer

up vote 2 down vote accepted

You should carefully read the documentation: http://wiki.nginx.org/JavaServers

After that, you can try this sample virtual host configuration and tweak it as needed in your case:

server {
  listen          80;
  server_name     YOUR_DOMAIN;
  root            /PATH/TO/YOUR/WEB/APPLICATION;

  location / {
    index.jsp;
  }

  location /projectName/ {
    proxy_pass              http://localhost:11000;
    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;
  }
}

If your port 10000 is not redirected to port 80 (I didn't really understand your explanation above), you should replace listen 80; with listen 10000;.

link|improve this answer
Im sorry but when you say virtual host configuration you mean my nginx.conf file? or what (I'm new with this) – RMT Jul 9 '11 at 17:06
@rmt, yes, virtual host is the nginx.conf and any other configuration files for nginx to setup web server. – Richards Jul 9 '11 at 17:23
Yes, you could put that in nginx.conf, but the Ubuntu-way is to put it in /etc/nginx/sites-available/YOUR_DOMAIN and link it from /etc/nginx/sites-enabled/YOUR_DOMAIN with the following command: ln -s /etc/nginx/sites-available/YOUR_DOMAIN /etc/nginx/sites-enabled/YOUR_DOMAIN – Vladimir Blaskov Jul 9 '11 at 17:25
I have already linked the 2, another thing Ive been googling this for a bit where is the web application default on tomcat 6? – RMT Jul 9 '11 at 17:26
@Vladimir Blaskov I did what you have suggested and instead of getting 404 page, I know get 403 (forbidden) – RMT Jul 10 '11 at 2:52
show 2 more comments
feedback

Your Answer

 
or
required, but never shown

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