成人无码视频,亚洲精品久久久久av无码,午夜精品久久久久久毛片,亚洲 中文字幕 日韩 无码

資訊專欄INFORMATION COLUMN

不一樣的nginx報(bào)錯(cuò)"Primary script unknown"

simpleapples / 1420人閱讀

摘要:昨天晚上忘記對(duì)開發(fā)環(huán)境做了什么改動(dòng),導(dǎo)致今天來了在進(jìn)行接口調(diào)試的時(shí)候提示這個(gè)大多數(shù)情況下來說是一個(gè)很簡單的問題配置里面的錯(cuò)誤。然而我檢查了我的配置,發(fā)現(xiàn)并沒有什么問題。

昨天晚上忘記對(duì)開發(fā)環(huán)境做了什么改動(dòng),導(dǎo)致今天來了在進(jìn)行接口調(diào)試的時(shí)候nginx提示"Primary script unknown",這個(gè)大多數(shù)情況下來說是一個(gè)很簡單的問題:nginx配置里面的script_filename錯(cuò)誤。然而我檢查了我的nginx配置,發(fā)現(xiàn)并沒有什么問題。

location ~ .php$ {
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass 127.0.0.1:9000;
        #fastcgi_pass unix:/var/run/php5-fpm.sock;
        try_files $uri =404;
    }

同時(shí),我也對(duì)這個(gè)配置進(jìn)行了驗(yàn)證,在http模塊的access日志格式配置里面加入請(qǐng)求文件名,并在sever模塊里面使用這個(gè)配置

log_format  main  "$remote_addr - $remote_user [$time_local] "$request" "
                  "$status $body_bytes_sent "$http_referer" "
                  ""$http_user_agent" "$http_x_forwarded_for" $document_uri $request_filename";
access_log  "logs/frontapi.access.log" main;

下面是打印的日志,經(jīng)過驗(yàn)證,這個(gè)配置確實(shí)是沒有問題的。

127.0.0.1 - - [18/Mar/2019:12:40:40 +0800] "GET /v1/product/search?category=2 HTTP/1.1" 404 27 "-" "PostmanRuntime/7.6.1" "-" /index.php /Users/xubandit/Documents/www/mmt/mmt-mall-php/frontapi/web/index.php
^C
xubanditdeMacBook-Pro:logs xubandit$ ll /Users/xubandit/Documents/www/mmt/mmt-mall-php/frontapi/web/index.php
-rwxr-xr-x  1 xubandit  staff  570  3  9 16:39 /Users/xubandit/Documents/www/mmt/mmt-mall-php/frontapi/web/index.php

然后又查了php代碼,發(fā)現(xiàn)請(qǐng)求根本就沒有到php代碼這邊來,也就是說問題出在了php-fpm,然后就想怎么對(duì)php-fpm進(jìn)行調(diào)試,查看了php-fpm的日志,發(fā)現(xiàn)日志里面只記錄了php-fpm master進(jìn)程的信息,子進(jìn)程里面進(jìn)行php處理的內(nèi)容是沒有日志的。

只能進(jìn)行進(jìn)程調(diào)試了,然而發(fā)現(xiàn)macos下面并沒有strace這個(gè)工具,好在有個(gè)替代品dtruss

xubanditdeMacBook-Pro:php-fpm.d xubandit$ sudo dtruss  -p 13735
dtrace: system integrity protection is on, some features will not be available

SYSCALL(args)          = return
poll(0x7FFEE3A437B0, 0x1, 0x1388)         = 1 0
getrusage(0x0, 0x7FFEE3A43670, 0x0)         = 0 0
getrusage(0xFFFFFFFFFFFFFFFF, 0x7FFEE3A43670, 0x0)         = 0 0
dtrace: error on enabled probe ID 2174 (ID 159: syscall::read:return): invalid kernel access in action #12 at DIF offset 68
dtrace: error on enabled probe ID 2174 (ID 159: syscall::read:return): invalid kernel access in action #12 at DIF offset 68
dtrace: error on enabled probe ID 2174 (ID 159: syscall::read:return): invalid kernel access in action #12 at DIF offset 68
dtrace: error on enabled probe ID 2174 (ID 159: syscall::read:return): invalid kernel access in action #12 at DIF offset 68
dtrace: error on enabled probe ID 2174 (ID 159: syscall::read:return): invalid kernel access in action #12 at DIF offset 68
lstat64("/Users/xubandit/Documents/www/mmt/mmt-mall-php/frontapi/web/index.php