nginx笔记
操作命令:
nginx -v 查看版本号
nginx -V 查看配置相关信息
nginx -s reload 重启
conf模块
events{
use epoll;------------------------------------------------------轮询方法
worker_connections 20000;---------------------------------------最大连接数
client_header_buffer_size 4k;-----------------------------------请求头缓存大小
open_file_cache max=2000 inactive=60s;--------------------------打开文件指定缓存
open_file_cache_valid 60s;--------------------------------------多少时间检查缓存
open_file_cache_min_uses 1;-------------------------------------在指定时间内至少使用缓存次数
}
upstream launcher {------------------------------------------------上游集群,用来转发
server 192.10.1.101:19905 ;
}
server {
listen 80;----------------------------------------------监听端口
server_name cloudtest.armvm.com;----------------------------请求头中服务器名称
location /portal {---------------------------------------------------------转发路径
proxy_set_header Host $http_host; ------------------------------请求头配置
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_buffering off;
proxy_pass http://launcher ;--------------------------------------转发路径
}
location /addr {--------------------------------------------------------加载静态资源
root /data/paas/address/;
}
}
listen 80; server_name cloudtest.armvm.com; #server_name 10.100.0.115;