1.基于 ip
server {
listen 80;
server_name 192.168.0.110;
access_log logs/host.access.log main;
location / {
root html/test;
index index.html ;
}
}
server {
listen 80;
server_name 192.168.0.111;
access_log logs/host.access.log main;
location / {
root html/test;
index test.html ;
}
}
~
2.基于域名
server {
listen 80;
server_name www.aa.com;
access_log logs/host.access.log main;
location / {
root html/test;
index index.html ;
}
}
server {
listen 80;
server_name www.bb.com;
access_log logs/host.access.log main;
location / {
root html/test;
index test.html ;
}
}
3.基于端口
server {
listen 80;
server_name www.aa.com;
access_log logs/host.access.log main;
location / {
root html/test;
index index.html ;
}
}
server {
listen 8080;
server_name www.aa.com;
access_log logs/host.access.log main;
location / {
root html/test;
index test.html ;
}
}