8,简单配置
我这次主要使用到tcp四层负载,后续可能涉及到https http2等,所以编译时添加了那些参数。
nginx.conf配置如下:
user www www;
worker_processes auto;
worker_cpu_affinity auto;
error_log logs/error.log error;
pid logs/nginx.pid;
worker_rlimit_nofile 653600;
events
{
use epoll;
worker_connections 655350;
}
stream {
upstream server {
hash $remote_addr consistent;
server 172.16.1.11:8081 weight=1 max_fails=3 fail_timeout=10s;
server 172.16.1.22:8081 weight=1 max_fails=3 fail_timeout=10s;
}
server {
listen 8081;
proxy_connect_timeout 1s;
proxy_timeout 3s;
proxy_pass server;
}
}
CentOS 7.2下编译安装PHP7.0.10+MySQL5.7.14+Nginx1.10.1
搭建基于Linux6.3+Nginx1.2+PHP5+MySQL5.5的Web服务器全过程
CentOS 6.3下配置Nginx加载ngx_pagespeed模块