返回列表 发帖
查看: 3153|回复: 4

[求助] 单独启动nginx和phpcgi无法访问UCenter

1

主题

6

回帖

13

积分

初学乍练

贡献
0 点
金币
6 个
发表于 2023-6-18 09:18:33 | 查看全部 |阅读模式
问题需求:
  1,点击 站长 ==》UCenter设置 后,正常显示通信成功
  2,window环境

问题描述:
  1,用apache 部署 -正常
  2,用phpstudy_pro 启动nginx(会自动启动 php-cgi) - 正常
  3,curl -X POST http://localhost/upload/uc_server/index.php?__times__=1 我尝试用命令 竟然可以请求通。 - 正常
  3,手动启动nginx 和 php-cgi.exe -b 127.0.0.1:9899 -c php.ini 后  - 连接不通,nginx提示错误如下:手动启动的时候,都是在window环境下 以管理员的身份运行的。

  1.    2023/06/18 08:02:05 [error] 13016#24968: *4 WSARecv() failed (10054: An existing connection was forcibly closed by the remote host) while reading response header from upstream,     client: 127.0.0.1, server: localhost, request: "POST /upload/uc_server/index.php?__times__=1 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost"
复制代码


问题:
  1,求大佬指点,问题出在那里
我知道答案 回答被采纳将会获得1 贡献 已有4人回答
回复

使用道具 举报

1

主题

6

回帖

13

积分

初学乍练

贡献
0 点
金币
6 个
 楼主| 发表于 2023-6-18 09:25:24 | 查看全部
nginx 配置 我觉得是没问题的。

  1. server {
  2.         listen        80;
  3.         server_name  localhost;
  4.         root   "D:/app/Apache24/htdocs";
  5.         location / {
  6.             # index index.php index.html;
  7.             # First attempt to serve request as file, then
  8.             # as directory, then fall back to displaying a 404.
  9.             try_files $uri $uri/index.php /index.php?$query_string;
  10.             error_page 400 /error/400.html;
  11.             error_page 403 /error/403.html;
  12.             error_page 404 /error/404.html;
  13.             error_page 500 /error/500.html;
  14.             error_page 501 /error/501.html;
  15.             error_page 502 /error/502.html;
  16.             error_page 503 /error/503.html;
  17.             error_page 504 /error/504.html;
  18.             error_page 505 /error/505.html;
  19.             error_page 506 /error/506.html;
  20.             error_page 507 /error/507.html;
  21.             error_page 509 /error/509.html;
  22.             error_page 510 /error/510.html;
  23.             include D:/app/Apache24/htdocs/nginx.htaccess;
  24.             autoindex  off;
  25.         }
  26.         location ~ \.php(.*)$ {
  27.             fastcgi_pass   127.0.0.1:9000;
  28.             fastcgi_index  index.php;
  29.             fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
  30.             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
  31.             fastcgi_param  PATH_INFO  $fastcgi_path_info;
  32.             fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
  33.             include        fastcgi_params;
  34.         }

  35.     }
复制代码
回复

使用道具 举报

1

主题

6

回帖

13

积分

初学乍练

贡献
0 点
金币
6 个
 楼主| 发表于 2023-6-18 14:54:10 | 查看全部
已解决:送给需要的朋友:
1,问题的具体出错点是:client.php 中的curl_exec方法
2,问题依据参考:http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_split_path_info
3,注意修改nginx的配置,具体如下:
  1.             fastcgi_split_path_info       ^(.+\.php)(.*)$;
  2.             fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  3.             fastcgi_param PATH_INFO       $fastcgi_path_info/index.php;
复制代码




回复

使用道具 举报

9

主题

488

回帖

625

积分

应用开发者

贡献
18 点
金币
13 个
QQ
发表于 2023-6-19 15:29:44 | 查看全部
楼主,你的nginx用的是哪个版本的?印象中高版本的nginx都支持pathinfo的
回复

使用道具 举报

1

主题

6

回帖

13

积分

初学乍练

贡献
0 点
金币
6 个
 楼主| 发表于 2023-7-8 08:02:18 | 查看全部
false001 发表于 2023-6-19 15:29
楼主,你的nginx用的是哪个版本的?印象中高版本的nginx都支持pathinfo的

用的是最新版本的3.5.x;  其实主要还是环境的问题用宝塔或者phpStudyPro 轻松可以搞定的。
只是我对其中的细节还想再琢磨一下
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 关注公众号
  • 有偿服务微信
  • 有偿服务QQ

手机版|小黑屋|Discuz! 官方交流社区 ( 皖ICP备16010102号 |皖公网安备34010302002376号 )|网站地图|star

GMT+8, 2025-12-20 08:47 , Processed in 0.048677 second(s), 12 queries , Redis On.

Powered by Discuz! X5.0 Licensed

© 2001-2025 Discuz! Team.

关灯 在本版发帖
有偿服务QQ
有偿服务微信
返回顶部
快速回复 返回顶部 返回列表