登录
首页 >  Golang >  Go问答

Nginx "Primary script unknown" while" 权限最高,配置正确,布吉岛哪里出了问题

来源:SegmentFault

时间:2023-02-24 13:08:01 272浏览 收藏

知识点掌握了,还需要不断练习才能熟练运用。下面golang学习网给大家带来一个Golang开发实战,手把手教大家学习《Nginx "Primary script unknown" while" 权限最高,配置正确,布吉岛哪里出了问题》,在实现功能的过程中也带大家重新温习相关知识点,温故而知新,回头看看说不定又有不一样的感悟!

问题内容

nginx/error.log

2017/08/08 18:57:57 [error] 21460#0: *11 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream,

Body 显示

File not found.

Http info

Request URL:http://dabaojian.com/test.php
Request Method:GET
Status Code:404 Not Found
Remote Address:10.108.213.187:30330
Referrer Policy:no-referrer-when-downgrade
Response Headers

Connection:close
Content-Encoding:gzip
Content-Type:text/html
Date:Tue, 08 Aug 2017 11:07:48 GMT
Server:Tengine/1.4.2
Transfer-Encoding:chunked
Request Headers

Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding:gzip, deflate
Accept-Language:zh-CN,zh;q=0.8,en;q=0.6
Cache-Control:max-age=0
Connection:keep-alive
Host:www.baidu.com 
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36

nginx.conf

worker_processes     4;
error_log  /home/test/conf/logs/error.log;
pid        /home/test/conf/logs/nginx.pid;

events {
    use epoll;
    worker_connections  4096;
}

http {
    access_log off;
    include       mime.types;
    sendfile                     on;
    gzip                         on;
    tcp_nopush                   on;
    tcp_nodelay                  on;

    keepalive_timeout            0;
    client_body_timeout          10;
    client_header_timeout        10;

    client_header_buffer_size    1k;
    large_client_header_buffers  4  4k;
    output_buffers               1  32k;
    client_max_body_size         64m;
    client_body_buffer_size      256k; 
 
    fastcgi_intercept_errors on;
    include vhost/*.conf;
}

vhost.conf

server
{
    listen 30330;
    server_name test.com;
    root /home/test/webRoot/www;

    index index.php;
    location / {
        rewrite ^/(.*)$ /index.php?$1 last;
    }

    location ~* \.(js|css|html|png|gif|jpeg|jpg|ico|xml|apk|eot|woff|pdf|swf|svg|jsx)$ {
        try_files $uri /resource/html/$uri =404;
    }

    location ~ \.php$ {
       fastcgi_pass 127.0.0.1:9000;
       include fastcgi.conf;
       fastcgi_index index.php;
    }
}

Fastcgi

fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  REQUEST_SCHEME     $scheme;
fastcgi_param  HTTPS              $https if_not_empty;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

fastcgi_param  REDIRECT_STATUS    200;

web服务目录为

777
权限

nginx:   nginx/1.9.15 
php-fpm: 5.5.25

正确答案

http://www.cnblogs.com/php-li...

好了,本文到此结束,带大家了解了《Nginx "Primary script unknown" while" 权限最高,配置正确,布吉岛哪里出了问题》,希望本文对你有所帮助!关注golang学习网公众号,给大家分享更多Golang知识!

声明:本文转载于:SegmentFault 如有侵犯,请联系study_golang@163.com删除
相关阅读
更多>
最新阅读
更多>
课程推荐
更多>