[推荐]用include指令实现nginx多虚拟主机配置

1.nginx.conf内容如下:

程序代码
worker_processes 1;
error_log  /host/nginx/logs/error.log  crit;
pid        /host/nginx/logs/nginx.pid;
events {
#使用的网络I/)模型,Linux系统推荐采用epoll模型,FreeBSD系统推荐采用kqueue模型
use epoll;
worker_connections  64;
}
http { 

include       /host/nginx/conf/mime.types;
default_type  application/octet-stream;

#charset  gb2312;

server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
keepalive_timeout 60;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 128k;
fastcgi_buffers 4 128k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
client_body_temp_path /host/nginx/client_body_temp;
proxy_temp_path /host/nginx/proxy_temp;
fastcgi_temp_path /host/nginx/fastcgi_temp; Continue reading