Nginx 多域名配置

修改配置文件

1
nginx.conf

添加多个 server 即可。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
...

server {
listen 80;
server_name a.xxx.com;

location / {
root C:\Web\aaa;
index index.html index.htm;
}
}

server {
listen 80;
server_name b.xxx.com;

location / {
root C:\Web\bbb;
index index.html index.htm;
}
}

server {
listen 80;
server_name c.xxx.com;

location / {
root C:\Web\ccc;
index index.html index.htm;
}
}

...