nginx
mr.杰瑞
只要开始就不算晚……
展开
-
mac 搭建自己的服务器nginx
最近想学一下nginx是如何实现负载均衡,所以首先你要有自己的nginx 1打开终端 2ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 安装 中途有一次回车 等待很久 3brew install nginx 4输入nginx 没有报错 说明已经安装好了 5在浏览器 输...原创 2019-07-21 13:22:51 · 682 阅读 · 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 · 100 阅读 · 0 评论 -
nginx 每秒万级并发优化
socket nginx 1.http连接快速关闭 keep_alivetime:0 2.子进程允许打开的连接 work_connections 10240; 系统 1.最大连接数 somaxconn 2.加快tcp连接的回收 tcp_tw_recycle 1 3.空tcp允许回收利用 tcp_tw_reuse 1 4.洪水攻击 不做洪水地域 tcp_syncookies 0 ...原创 2019-08-19 22:34:03 · 2406 阅读 · 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-config make && make install pkill -9 php 杀php ./sbin/ph...原创 2019-08-18 20:42:56 · 169 阅读 · 0 评论 -
nginx Location是如何进行匹配的
=精准匹配 ~正则表达 一般匹配 精准匹配优先级最高,下来是正则 location = patt{ root xxxx index xxxx } location 里面不写root会继承系统默认的配置原创 2019-08-05 22:05:24 · 188 阅读 · 0 评论 -
nginx 如何配置日志及切割日志
$remote addr -$remote_user[$time_local] "$request" ip地址 请求方式 ‘$status $body_bytes_sent’ 状态 请求多少字节 “$http_referer” 从哪个页面进来的 “$http_user_agent” 用户代理 “$http_x_forwarded_for” 可以用来伪装ip nginx/sbin/nginx...原创 2019-08-04 15:07:00 · 103 阅读 · 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 · 116 阅读 · 0 评论 -
nginx 如何设置缓存
nginx 的expires设置 nginx中设置过期时间 location或if expires 30s; s秒m分h小时d天 如果没有过期,再次访问相同地址,可以看到请求是来自于缓存 location ~image { expires 1d; } *符号不区分大小写 location ~* .(jpg|jpeg|gif|png){ root html; expires 1d; } 看浏...原创 2019-08-12 22:15:22 · 784 阅读 · 0 评论