
nginx
mr.杰瑞
只要开始就不算晚……
展开
-
mac 搭建自己的服务器nginx
最近想学一下nginx是如何实现负载均衡,所以首先你要有自己的nginx1打开终端2ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"安装中途有一次回车等待很久3brew install nginx4输入nginx没有报错 说明已经安装好了5在浏览器 输...原创 2019-07-21 13:22:51 · 712 阅读 · 0 评论 -
nginx 反向代理所谓的动静分离及负载均衡
proxy 用来做反向代理upstream 用来做负载均衡反向代理:就是nginx自己不去处理,将请求进行转发到别的服务器(apache)进行处理例:nginx处理html 通过代理 用apache处理php (httpd.conf)(./bin/apachectl start) ,反向代理例location ~ .php$ {proxy_pass http://192.168.1....原创 2019-08-14 22:56:42 · 116 阅读 · 0 评论 -
nginx 每秒万级并发优化
socketnginx 1.http连接快速关闭 keep_alivetime:02.子进程允许打开的连接 work_connections 10240;系统 1.最大连接数 somaxconn2.加快tcp连接的回收 tcp_tw_recycle 13.空tcp允许回收利用 tcp_tw_reuse 14.洪水攻击 不做洪水地域 tcp_syncookies 0...原创 2019-08-19 22:34:03 · 2448 阅读 · 0 评论 -
nginx 连memcached 集群实现负载均衡
tar zxvf memcache-2.2.7.tgz 解压cd memcache-2.2.7/usr/local/fastphp/bin/phpize./configure --with-php-config=/usr/local/fastphp/bin/php-configmake && make installpkill -9 php 杀php./sbin/ph...原创 2019-08-18 20:42:56 · 194 阅读 · 0 评论 -
nginx Location是如何进行匹配的
=精准匹配 ~正则表达 一般匹配精准匹配优先级最高,下来是正则location = patt{root xxxxindex xxxx}location 里面不写root会继承系统默认的配置原创 2019-08-05 22:05:24 · 214 阅读 · 0 评论 -
nginx 如何配置日志及切割日志
$remote addr -$remote_user[$time_local] "$request"ip地址 请求方式‘$status $body_bytes_sent’状态 请求多少字节“$http_referer” 从哪个页面进来的“$http_user_agent” 用户代理 “$http_x_forwarded_for” 可以用来伪装ipnginx/sbin/nginx...原创 2019-08-04 15:07:00 · 123 阅读 · 0 评论 -
nginx 如何使用信号量
ps aux|grep nginx 查看nginx进程kill HUP 进程号 平滑关闭旧配置读取新配置 不会立即生效window.location.href = /; //一直刷新tail -10 ./access.log #tail -n 20 filename 说明:显示filename最后20行nginx 日志存储用的是节点,与文件名无关,所以不论你把文件名改成什么,...原创 2019-07-21 20:25:44 · 140 阅读 · 0 评论 -
nginx 如何设置缓存
nginx 的expires设置nginx中设置过期时间location或ifexpires 30s; s秒m分h小时d天如果没有过期,再次访问相同地址,可以看到请求是来自于缓存location ~image {expires 1d;}*符号不区分大小写location ~* .(jpg|jpeg|gif|png){root html;expires 1d;}看浏...原创 2019-08-12 22:15:22 · 819 阅读 · 0 评论