使用include进行nginx.conf文件
1. 编辑文件vim /usr/local/nginx/conf/nginx.confworker_processes 1;events { worker_connecti ons 1024;}http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; include extra/baobaotao.conf; include extra/etiantian.conf; include extra/blog.conf;}
2.创建目录
mkdir -p /usr/local/nginx/conf/extra3.创建文件(其他的etiantian/baobaotao.conf类似)
vim /usr/local/nginx/conf/extra/baobaotao.confserver { listen 80; server_name www.baobaotao.com; location / { root html/baobaotao; index index.html index.htm; }}
4. 检查配置,重启服务
cd /usr/local/nginx/sbin./nginx -t 【测试ok后重启服务】5. 配置hosts(这里全部是宿主主机的IP)
echo "192.168.25.144 www.baobaotao.com" >> /etc/hostsecho "192.168.25.144 www.etiantian.com" >> /etc/hostsecho "192.168.25.144 www.blog.com" >> /etc/hoststail /etc/hosts
6. 测试