1、http://wmpublish.mp.sztv.com.cn:8026/wx/robots.txt ,响应成功,表明 Nginx 的配置是正确的
User-agent: * Disallow: /
2、http://wmpublish.mp.sztv.com.cn:8026/v1/channel-app-sources?group_id=channel ,响应失败,没有指定输入文件
No input file specified.
3、在容器中运行命令,查看 Nginx 错误日志,如图1
cat /var/log/nginx/error.log
2018/09/28 03:27:00 [error] 464#464: *225 FastCGI sent in stderr: "Unable to open primary script: /sobey/www/channel-pub-api/api/web/index.php (No such file or directory)" while reading response header from upstream, client: 192.168.8.4, server: wmpublish.mp.sztv.com.cn, request: "GET /v1/channel-app-sources?filter[source_uuid]=27ba60d97ebc92f093502e4e12a37e7f&filter[status]=1&group_id=spider&filter=spider HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "wmpublish.mp.sztv.com.cn:8026"
4、在容器中运行命令,查看文件内容,发现文件是存在的,如图2
cat /sobey/www/channel-pub-api/api/web/index.php
<?php defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_ENV') or define('YII_ENV', 'dev'); require __DIR__ . '/../../vendor/autoload.php'; require __DIR__ . '/../../vendor/yiisoft/yii2/Yii.php'; require __DIR__ . '/../../common/config/bootstrap.php'; require __DIR__ . '/../config/bootstrap.php'; $config = yii/helpers/ArrayHelper::merge( require __DIR__ . '/../../common/config/main.php', require __DIR__ . '/../../common/config/main-local.php', require __DIR__ . '/../config/main.php', require __DIR__ . '/../config/main-local.php' ); (new yii/web/Application($config))->run();
5、执行命令:ps -u nginx,显示 nginx 用户下的所有进程,正常情况(开发环境),应该如下所示,如图3
ps -u nginx
PID TTY TIME CMD 477 ? 00:00:03 nginx 478 ? 00:00:05 nginx 479 ? 00:00:06 nginx 480 ? 00:00:04 nginx 4672 ? 00:00:00 php-fpm 4673 ? 00:00:00 php-fpm 4674 ? 00:00:00 php-fpm 4675 ? 00:00:00 php-fpm 4676 ? 00:00:00 php-fpm 4677 ? 00:00:00 php-fpm 4678 ? 00:00:00 php-fpm 4679 ? 00:00:00 php-fpm 4680 ? 00:00:00 php-fpm 4681 ? 00:00:00 php-fpm 4682 ? 00:00:00 php-fpm 4683 ? 00:00:00 php-fpm 4684 ? 00:00:00 php-fpm 4685 ? 00:00:00 php-fpm 4686 ? 00:00:00 php-fpm 4687 ? 00:00:00 php-fpm 4688 ? 00:00:00 php-fpm 4689 ? 00:00:00 php-fpm 4690 ? 00:00:00 php-fpm 4691 ? 00:00:00 php-fpm
6、执行命令:ps -u nginx,显示 nginx 用户下的所有进程,发现没有 php-fpm,如图4
ps -u nginx
PID TTY TIME CMD 463 ? 00:00:03 nginx 464 ? 00:00:05 nginx 465 ? 00:00:06 nginx 466 ? 00:00:04 nginx
7、最后分析结果,原因在于 9000 端口已经被占用,导致 php-fpm 启动失败,将占用 9000 端口的服务停止,则 php-fpm 启动成功。http://wmpublish.mp.sztv.com.cn:8026/v1/channel-app-sources?group_id=channel ,响应成功
<?xml version="1.0" encoding="UTF-8"?> <response><code>10000</code><message>获取渠道的应用的来源列表成功</message><data><items><stdClass/></items><_links><self><href>http://wmpublish.mp.sztv.com.cn:8026/v1/channel-app-sources?group_id=channel&per-page=1&page=1</href></self></_links><_meta><totalCount>0</totalCount><pageCount>0</pageCount><currentPage>1</currentPage><perPage>1</perPage></_meta></data></response>
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/250437.html