nginx之fastcgi配置

server {
    listen 80;
    default_type text/plain;
    server_name fpm.haosheng.vip;
    root www;
    location / {
        # Matches URLS `$_GET['_url']`
        try_files $uri $uri/ /index.php?_url=$uri&$args;
    }

    location ~ [^/].php(/|$) {
        fastcgi_split_path_info ^(.+?.php)(/.*)$;
        include fastcgi_params;
        fastcgi_pass 127.0.0.1:9000;
        if (!-f $document_root$fastcgi_script_name) {
            return 404;
        }
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    location ~ /.ht {
        deny all;
    }

    location ~* .(js|css|png|jpg|jpeg|gif|ico)$ {
        expires       max;
        log_not_found off;
        access_log    off;
    }

    location ~ ^/fpm_status$ {
        rewrite ^/fpm_status$ /status break;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
        fastcgi_pass 127.0.0.1:9000;
    }
}
原文地址:https://www.cnblogs.com/sanshuiqing/p/14558141.html