nginx-PNG 文件通过fastcgi吗?

nginx-PNG 文件通过fastcgi吗?

面对下面的错误时,我注意到 PNG 文件似乎正在通过 fastcgi。我对 nginx 不太熟悉,但我觉得这似乎是错误的。

我确实尝试将一些 PHP 代码放入 PNG 文件中,但没有执行。

[warn] 2507#0: *35744 an upstream response is buffered to a temporary file /www/wdlinux/nginx-1.8.1/fastcgi_temp/9/60/0000012609 while reading upstream, client: 888.888.888.888, server: example.com, request: "GET /images/25.png HTTP/1.1", upstream: "fastcgi://unix:/tmp/php-55-cgi.sock:", host: "example.com", referrer: "http://example.com/app.php"

这里有问题还是我太天真了。我以为 nginx 只会发送静态文件,而不会通过任何与 cgi 相关的东西发送它们。

一些可能相关的文件:

# nginx conf conf/nginx.conf
# Created by http://www.wdlinux.cn
# Last Updated 2010.06.01
user  www www;
worker_processes  3;
error_log  logs/error.log  notice;
pid        logs/nginx.pid;
worker_rlimit_nofile 5120;
events {
    use epoll;
    worker_connections  5120;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    server_names_hash_bucket_size 128;
    client_header_buffer_size 256k;
    large_client_header_buffers 8 64k;
    client_max_body_size 100m;
    limit_conn_zone $binary_remote_addr zone=one:32k;

    sendfile        on;
    tcp_nopush     on;

    keepalive_timeout  60;
    tcp_nodelay on;

    gzip  on;
    gzip_min_length  1k;
    gzip_buffers     4 16k;
    gzip_http_version 1.0;
    gzip_comp_level 2;
    gzip_types       text/plain application/x-javascript text/css application/xml;
    gzip_vary on;

    log_format  wwwlogs  '$remote_addr - $remote_user [$time_local] $request $status $body_bytes_sent $http_referer $http_user_agent $http_x_forwarded_for';
    #include default.conf;
    include vhost/*.conf;
}

naproxy配置文件

proxy_connect_timeout 30s;
proxy_send_timeout   90;
proxy_read_timeout   90;
proxy_buffer_size    32k;
proxy_buffers     4 32k;
proxy_busy_buffers_size 64k;
proxy_redirect     off;
proxy_hide_header  Vary;
proxy_set_header   Accept-Encoding '';
proxy_set_header   Host   $host;
proxy_set_header   Referer $http_referer;
proxy_set_header   Cookie $http_cookie;
proxy_set_header   X-Real-IP  $remote_addr;
proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;

Vhost文件

server {
        listen       80;
        root /mnt/web/example/public_html;
        server_name example.com example.com;
        index  index.html index.php index.htm;
        error_page  400 /errpage/400.html;
        error_page  403 /errpage/403.html;
        error_page  404 /errpage/404.html;
        error_page  503 /errpage/503.html;
        location ~ \.php(.*)$ {
                fastcgi_pass  unix:/tmp/php-55-cgi.sock;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME  $DOCUMENT_ROOT$fastcgi_script_name;
                fastcgi_param PATH_INFO $2;
                include fcgi.conf;
        }
        location ~ /\.ht {
                deny  all;
        }
        location / {
                 try_files $uri $uri/ /?$args;
        }
}

如果需要更多文件,我会添加它们,谢谢!

答案1

如果您的系统中没有文件,nginx 将向PHP 处理器/mnt/web/example/public_html/images/25.png发送请求。http://example.com/images/25.png

此行为已在行中指定try_files $uri $uri/ /?$args;

相关内容