NGINX加载多个COF文件配置

nginx.conf 总的配置
 
#############################################################
#
#          
#           nginx 反向代理设置,统一集管处,机器不够的话开集群。
#         包括:
#             SSL,限流,跨域,集群,黑名单,白名单,负载均衡
#
#############################################################
 
user nginx;
 
#指定进程数
worker_processes auto;
 
#错误日志
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
 
#动态加载外部配置文件【inclue 路径 + *.conf 】
include /usr/share/nginx/modules/*.conf;
 
#每个进程的最大连接数 
events {
    worker_connections 1024;
}
 
http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
 
    #access_log  /var/log/nginx/access.log  main;
    access_log  /wwwlogs/httpproxy.log  main;
 
    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;
 
    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;
 
    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    # 加载配置
    include /etc/nginx/conf.d/*.conf;
    #加载upstream模块
    include /usr/share/nginx/ups_modules_http.conf;
    #加载http server 模块
    include /usr/share/nginx/http_servers/*.conf;    
 
}
 
stream {
    log_format proxy '$remote_addr [$time_local] '
                 '$protocol $status $bytes_sent $bytes_received '
                 '$session_time "$upstream_addr" '
                 '"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"';
 
    access_log /wwwlogs/tcp-access.log proxy;
    open_log_file_cache off;
 
    #挂载盘opt/nginx/conf/modules
    include /usr/share/nginx/conf_servers/*.conf;
}

在con_server/可以配置多个 A系统.conf文件

server {
		listen 8888;
		location / { 
			#通过代理将请求发送给 upstream 命名的HTTP 服务
			proxy_pass http://myserver;
		}
	}
	
#定义一个 HTTP 服务组
upstream  myserver{
		#用server定义HTTP 地址。后面不写默认轮询。
		server 127.0.0.1:8081 max_fails=5 fail_timeout=10s weight=10;
		server 127.0.0.1:8082;
		server 127.0.0.1:8083;
	}

B系统conf文件
server {
    listen       80;
    server_name  127.0.0.1;
 
    location = /test {
        default_type text/html;
        return 200  'good';
    }
}
  • 13
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值