- nginx编译时携带 --with-stream 参数
./configure --prefix=/home/nginx
–conf-path=/home/nginx/nginx.conf
–user=nginx --group=nginx
–with-http_stub_status_module
–with-http_gzip_static_module
–with-http_realip_module
–with-http_ssl_module
–with-luajit --with-http_v2_module
–with-http_drizzle_module
–with-stream
- nginx配置
# 配置work进程数,一般配置和CPU核心数相等
# 最懒配置,直接系统自动适配
# worker_processes auto;
worker_processes 1;
# 记录错误日志
error_log logs/error.log;
# 管理进程,有问题就可以直接杀pid
pid logs/nginx.pid;
# 每个work的最大连接数,可以同时处理多少请求(那总的最大连接数就是 worker_processes * worker_connections)
events {
worker_connections 1024;
}
http {
# 日志格式
log_format main '$remote_addr - $remote_user [