标签:bsp connect 优先 etc 代理 备份 default index list
全局配置指令:
user nginx;
模块配置段 
# 事件驱动模块,提供并发响应功能
events{
......
}
# http模块,提供web请求处理,可嵌套其他重要模块
http{
.......#server{}
}
开始配置:#备份nginx.conf ,清空文件
# vim /etc/hosts   增加主机记录
vim  /etc/nginx/nginx.conf
worker_processes 2;			# 两个nginx进程
events {
worker_connections 1024;	   # 可同时处理1024个http请求
}
http {
include  mime.types;		#调用mime ,可以处理多媒体
default_type application/octet-stream;
upstream test {
# ip_hash;			# 基于客户端的hash值进行请求分配
server test1.com   weight=10;	# 权重负载
server test2.com   weight=20;
}
server {
listen 80;
server_name afan.com;  # 用户输入网页先匹配到server{}中
location / {								
proxy_pass http://test/index.html;  # 扔给后端服务器,
# html 是upstream的引用,先扔给 upstream html{}模块
}
}
#############################################3
server {					#nginx至少有个虚拟主机才能工作
listen 80;	
server_name Localhost;	   # 虚拟主机名称		
access_log /var/log/nginx/access_html.log  html_log;      #若localtion中,优先
root html;   # 网站主目录 ,一般是配置文件所在的目录
location{}
}
}
# 压力测试:# while true; do curl afan.com;done
# shell :   for i in `seq 1 20` ;do
curl afan.com
sleep 0.5
done
标签:bsp connect 优先 etc 代理 备份 default index list
原文地址:https://www.cnblogs.com/wanzf/p/10654099.html