//对域名aaa.example.com
server {
listen 80; //监听端口号
server_name aaa.example.com; //主机名称
access_log logs/aaa.example.com_access.log combined;
location /
{
index index.php index.html index.htm; //默认首页文件
root /www/aaa.example.com; //网站目录
}
}
//对域名bbb.example.com
server {
listen 80; //监听端口号
server_name bbb.example.com; //主机名称
access_log logs/bbb.example.com_access.log combined;
location /
{
index index.php index.html index.htm; //默认首页文件
root /www/bbb.example.com; //网站目录
}
}
//对域名www.example.com,example.com和除了aaa.example.com,bbb.example.com外的所有*.example.com
server {
listen 80; //监听端口号
server_name www.example.com example.com *.example.com; //主机名称
access_log logs/www.example.com_access.log combined;
location /
{
index index.php index.html index.htm; //默认首页文件
root /www/www.example.com; //网站目录
}
} 本文出自 “燕雀安知鸿鹄之志哉” 博客,请务必保留此出处http://who0168.blog.51cto.com/253401/569553
|