window服务器如何用nginx实现2个域名分别对应二个项目

1、window服务器绑定了二个域名www.test.com,bbs.test.com. 现有2个tomcat发布项目分别是http://localhost,http://localhost:8081/project,
现在用nginx想实现www.test.com就访问http://localhost,bbs.test.com就访问http://localhost:8081/project.我用了nginx1.8配置,却一直不成功。
2、nginx.conf我是这样配置的:
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name www.test.com;

location / {
proxy_pass http://localhost;
}
}
server {
listen 80;
server_name bbb.test.com;

location / {
proxy_pass http://localhost:8081/project;
}
}
}

看看你的server_name是否都生效了,看上去你的虚拟主机没有配置成功
还有你不生效的表现是什么

配置主机头
http://lobert.iteye.com/blog/1931657

在nginx中配置请求头,

    location / {
        proxy_set_header   Host             $Host;
        proxy_set_header   X-Real-IP        $remote_addr;
        proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_pass http://;
    }