zoukankan      html  css  js  c++  java
  • nginx频繁的返回502

    A couple of websites on our DigitalOcean VPS  have a great amount of traffic. Due to this traffic, I ran into the error below (edited for readability).

    [crit] connect() to unix:/var/run/php5-fpm.socket failed 2 No such file or directory

    This was because the amount of concurrent users was starting to get high. Instead of fiddling around too much, I thought it best to simply switch to a TCP/IP fast_param, as it's more scalable by default than using a socket.

    To do this, we need to edit a couple of files.

    PHP5-FPM:

    $ sudo nano /etc/php5/fpm/pool.d/www.conf

    In this file, find the below line and uncomment it.

    ;listen = 127.0.0.1:9000

    If you have already have listen = unix:/var/run/php5-fpm.socket; in there, or another file in the pool.d folder, comment it out or replace it with the TCP/IP.

    Nginx:

    Next, we'll need to edit the Virtual Host config files, which may be located in /etc/nginx/sites-available. Hopefully, you've used one global file for all of your PHP sites, otherwise you'll need to edit multiple files for each site. Look for:

    fastcgi_pass unix:/var/run/php5-fpm.sock;

    Comment it out or replace it with:

    fastcgi_pass 127.0.0.1:9000;

    Now we can get things reloaded.

    $ sudo service nginx reload
    $ sudo service php5-fpm reload

     ==https://www.obstance.com/articles/linux/switching-from-using-a-socket-to-tcpip-in-php-fpm-r32/

  • 相关阅读:
    将excel单元格中的内容,批量转化成批注
    装饰器的入门到精通
    自定义dict
    python2.7 + PyQt4安装
    一些好用的python模块
    人工智能-自然语言处理
    websocket-单群聊
    UA池和代理池
    scrapy框架持久化存储
    SQL Server 2012 酸爽的安装体验
  • 原文地址:https://www.cnblogs.com/qinqiu/p/5596012.html
Copyright © 2011-2022 走看看