首先我的项目比较多,但是服务器就一个,如何才能保证我在监听80端口的同时,又使得我的域名下不会出现www.a.com:81,www.b.com:82等尴尬呢?
具体nginx的配置如下:
server {
listen 80;
server_name www.a.com;
charset utf-8;
access_log /home/a.com.access.log main;
location / {
proxy_pass http://127.0.0.1:81;
}
}
server {
listen 80;
server_name www.b.com;
charset utf-8;
access_log /home/b.com.access.log main;
location / {
proxy_pass http://127.0.0.1:82;
}
}