Ubuntu nginx 502 bad getaway
来源:互联网 发布:网络应急协调中心待遇 编辑:程序博客网 时间:2024/06/04 18:59
一、查看错误信息
1.出现 nginx 502 bad getaway 后,查看 nginx 错误信息
tailf /var/log/nginx/error.log 2019/02/30 24:36:50 [error] 1924#0: *27095 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: xxx.xxx.xxx.xxx,...
这类错误消息有数百行。因为它说,连接到PHP-fpm.sock是失败的。它说,该资源(PHP-fpm.sock)暂时不可用。这意味着它是越来越高负载。其在高负载情况下的问题是众所周知的。
解决方案:
使用Unix套接字稍微快一些,因为它提供你没有任何的TCP / IP开销直接网络接入。不利的一面,它不是可伸缩如TCP / IP。当 sockets 已经所剩无几的Nginx将引发502错误。在这种情况下,你可以调整操作系统设置,以适应更大的连接池或只需切换到TCP / IP。
二、php5+nginx : 从Unix套接字切换到TCP/IP
1. 打开PHP-FPM池的配置文件:
sudo vi /etc/php5/fpm/pool.d/www.conf
2. 搜索以下行,并取消注释 :
listen.backlog = 65536
3. 现在搜索以下行
listen = /var/run/php5-fpm.sock
并替换成如下:
listen = 127.0.0.1:9000
4. 被更改的php-fpm的现在完成了。但还应该做的Nginx虚拟主机配置。打开虚拟主机文件下列命令
sudo vi /etc/nginx/sites-available/default
寻找下面的行,
fastcgi_pass unix:/var/run/php5-fpm.sock;
并替换成如下:
fastcgi_pass 127.0.0.1:9000;
5. 现在重新启动 php5-fpm 和 nginx
sudo service php5-fpm restart
sudo service nginx restart
0 0
- Ubuntu nginx 502 bad getaway
- Ubuntu 14.04 nginx 502 bad getaway 处理及优化
- Ubuntu 14.04 nginx 502 bad getaway 处理及优化
- unbuntu下 nginx php-fpm.sock 502 bad getaway权限问题,解决方法
- ubuntu+nginx 出现502 bad gateway解决方法
- nginx 502 bad gateway
- nginx 502 Bad Gateway
- 502 Bad Gateway nginx
- nginx 502 bad gateway
- nginx 502 bad gateway
- 解决nginx 502 bad gateway
- Homestead nginx 502 Bad Gateway
- nginx 502 Bad Gateway 错误问题收集
- nginx 502 Bad Gateway 错误问题收集
- nginx 502 Bad Gateway 错误问题收集
- nginx 502 Bad Gateway 错误解决办法
- Nginx 502 Bad Gateway错误的解决办法
- nginx 502 Bad Gateway 错误问题收集
- iOS原生效果集成UItableView左滑多个删除按钮
- 使用AddHandler 方法处理已经被处理的事件
- stirng与json进行数据格式转换的时候需要的jar包
- 极客班
- Ubuntu 部署 solr6.3.0 环境jdk1.8 tomcat9
- Ubuntu nginx 502 bad getaway
- C++使用第三方library
- 包含简单科学运算的表达式求值
- <context-param>与<init-param>的区别与作用
- js之类型转换与引用类型(Boolean/Number/String)
- Linux下MySQL默认安装目录和常用命令
- Notepad 格式化JS
- 【synchronized关键词】高并发下地单例模式
- leetcode 416 c++. Partition Equal Subset Sum