基于IP的虚拟主机:
server {
listen 192.168.10.11:80;
server_name web.11.com;
location / {
root /11/html;
index index.html index.htm;
}
}
server {
listen 192.168.10.12:80;
server_name web.12.com;
location /{
root /12/html;
index index.html index.htm;
}
}
基于端口的虚拟主机:
server {
listen 1111;
server_name web.11.com;
location /{
root /11/html;
index index.html index.htm;
}
}
server {
listen 1212;
server_name web.11.com;
location /{
root /12/html;
index index.html index.htm;
}
}
原文:http://blog.51cto.com/13553337/2295902