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是否都生效了,看上去你的虛擬主機沒有配置成功
還有你不生效的表現是什麼