zoukankan      html  css  js  c++  java
  • 记一次504 Gateway Time-out

    使用curl请求是超时,查了下资料原来是端口被占用,造成了死锁,记录下

    首先要知道为什么会出现死锁?

      在我们访问页面的时候这个端口进程就已经被使用,当我们再在页面中curl请求其他页面因为没有其他的端口,php-cgi当然还要使用9000,就造成了阻塞所以就死锁了。

    运行环境:windows + nginx + php

    解决方法:

    打开cmd,执行

    D:App_selfphpstudyPHPTutorialphpphp-7.0.12-ntsphp-cgi.exe -b 127.0.0.1:9001 -c D:App_selfphpstudyPHPTutorialphpphp-7.0.12-ntsphp.ini

    注意,cmd窗口不要关闭

    再在请求页的vhost配置文件中修改

            location ~ .php(.*)$ {
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                fastcgi_split_path_info  ^((?U).+.php)(/?.+)$;
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                fastcgi_param  PATH_INFO  $fastcgi_path_info;
                fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
                include        fastcgi_params;
            }

    这里的fastcgi_pass要改成127.0.0.1:9001,即cmd开启的端口。

    over

    推荐一个nginx+php-cgi的运行原理,很不错,要常看

     http://www.cnblogs.com/mangguoxiansheng/p/5967745.html

  • 相关阅读:
    dup/dup2函数
    read/write函数
    lseek函数
    流程控制
    vim普通模式
    vim实用技巧1
    python源代码解读
    python变量命名规则
    python之字符串2
    Docker系列文章
  • 原文地址:https://www.cnblogs.com/two-bees/p/10615602.html
Copyright © 2011-2022 走看看