欢迎来到天天文库
浏览记录
ID:37711029
大小:17.51 KB
页数:5页
时间:2019-05-29
《nginx多虚拟主机配置》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、1.nginx.conf内容如下: 程序代码worker_processes1;error_log /host/nginx/logs/error.log crit;pid /host/nginx/logs/nginx.pid;events { worker_connections 64;}http { include /host/nginx/conf/mime.types; default_type application/octet-stream; #charset gb2312;
2、 server_names_hash_bucket_size128; client_header_buffer_size32k; large_client_header_buffers432k; keepalive_timeout60; fastcgi_connect_timeout300; fastcgi_send_timeout300; fastcgi_read_timeout300; fastcgi_buffer_size128k; fastcgi_buffers4128k; fa
3、stcgi_busy_buffers_size128k; fastcgi_temp_file_write_size128k; client_body_temp_path /host/nginx/client_body_temp; proxy_temp_path /host/nginx/proxy_temp; fastcgi_temp_path /host/nginx/fastcgi_temp; gzip on; gzip_min_length 1k; gzip_buffers 416k; gzip_
4、http_version1.0; gzip_comp_level2; gzip_types text/plainapplication/x-javascript text/cssapplication/xml; gzip_vary on; client_header_timeout 3m; client_body_timeout 3m; send_timeout 3m; sendfile on; tcp_nopush
5、 on; tcp_nodelay on; #设定虚拟主机 include /host/nginx/conf/vhost/www_test_com.conf; include /host/nginx/conf/vhost/www_test1_com.conf; include /host/nginx/conf/vhost/www_test2_com.conf;}2.在conf目录下建立个vhost目录,在vhost目录下分别建立www_test_com.conf,ww
6、w_test1_com.conf,www_test2_com.conf3个文件www_test_com.conf代码如下: 程序代码server{ listen202.***.***.***:80; #换成你的IP地址 client_max_body_size100M; server_name www.test.com; #换成你的域名 charsetgb2312; indexindex.html index.htmindex.php; root /host/wwwroot/test;
7、 #你的站点路径 #打开目录浏览,这样当没有找到index文件,就也已浏览目录中的文件 autoindex on; if (-d$request_filename) { rewrite ^/(.*)([^/])$http://$host/$1$2/permanent; } error_page 404 /404.html; location = /40x.html { root /host/wwwroot/test; #你的站点路径
8、 charset on; } #redirectserve
此文档下载收益归作者所有