弄清楚thinkphp的nginx配置问题

一个比较完整的配置如下,我会标出需要注意的地方

server {
    listen       80;
    listen  [::]:80;
    listen       443 ssl;
    server_name  localhost;

    root   /var/www/php/public;

    ssl_certificate     /var/www/php/docker/nginx/test/https.pem;
    ssl_certificate_key /var/www/php/docker/nginx/test/https.key;
    ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers         HIGH:!aNULL:!MD5;

    index index.php;

    #access_log  /var/log/nginx/host.access.log  main;

    location / {
        try_files $uri $uri/ /index.php$uri$is_args$query_string;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~.*.php($|/) {
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        # fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        # fastcgi_pass   php-fpm:9000;
        # fastcgi_index  index.php;
        fastcgi_pass   unix:/var/tmp/php-fpm/php-fpm.sock;
        fastcgi_param  SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        fastcgi_param  PATH_INFO $fastcgi_path_info; # TP要这玩意

        include        fastcgi_params;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}