nginx访问php文件

server {
        listen       80;
        server_name  ctail.top;
        root /data;
        index index.php;
        #location / {
        #       root    /data;
        #        index   index.php;
        #}

        location ~ .php$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $DOCUMENT_ROOT$fastcgi_script_name;
            include        fastcgi_params;
        }
    }

  

  1. location / {
  2. index index.htm index.html index.php;
  3. #使其支持Thinkphp的rewrite模式
  4. if (!-e $request_filename) {
  5. rewrite ^(.*)$ /index.php?s=$1 last;
  6. break;
  7. }
  8. }
  9. location ~ .+\.php($|/) {
  10. fastcgi_index index.php;
  11. #使其支持thinkphp的pathinfo模式
  12. fastcgi_split_path_info ^(.+\.php)(.*)$;
  13. include fastcgi_params;
  14. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  15. fastcgi_param SCRIPT_NAME $fastcgi_script_name;
  16. fastcgi_param PATH_INFO $fastcgi_path_info;
  17. fastcgi_pass 127.0.0.1:9000;
  18. }
  19. include fastcgi.conf;
posted @ 2020-03-15 16:20  冷空气的清晰  阅读(575)  评论(0编辑  收藏  举报