通信机制的选择
nginx和php-fpm 是使用 tcp socket 还是 unix socket ?
合理的配置nginx处理请求数
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 1
- 2
- 3
- 4
- 5
- 6
- 7
配置nginx+php-fpm负载均衡
单机能力有限,比如要支持1000台并发,生成两个sock文件,让每个PHP-fpm处理500台。
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
禁止访问日志文件
高流量站点涉及大量I/O,必须在线程间同步。
- 1
- 2
- 3
- 4
- 1
- 2
- 3
- 4
如果不能关闭日志访问,至少设置缓冲
- 1
- 1
启用GZip
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
缓存经常访问的文件
- 1
- 2
- 3
- 4
- 5
- 1
- 2
- 3
- 4
- 5
调整客户端超时
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
调整输出缓冲区
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
调整/etc/sysctl.conf
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
Nginx状态监控
Nginx中的stub_status模块主要用于查看Nginx的一些状态信息,默认不会编译进Nginx,重新编译安装nginx stub_status模块,
持续监视打开的连接数,可用内存和等待线程数。 设置警报以在阈值超过时通知您。您可以自己构建这些警报,或使用像ServerDensity。 请务必安装NGINX stub_status模块 你需要重新编译NGINX -
- 1
- 2
- 3
- 4
- 5
- 1
- 2
- 3
- 4
- 5
安装完毕后在server块中加入location
- 1
- 2
- 3
- 4
- 5
- 1
- 2
- 3
- 4
- 5
重启nginx后访问www.x.com/nginx-status即可看到返回的信息