php tp5 nginx配置文件

server
  {
    listen       80;
    server_name  baidu.com;
    index  index.php index.htm index.html;
    root /data/www/baidu;
    charset utf-8;
            
    location / {
            index index.php;
            if (!-e $request_filename) {
                    rewrite ^/(.*)$  /index.php?s=/$1 last;
                    break;
            }
    }
    location /status {
        stub_status on;
    }
     location ~ \.php(.*)$
    {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
       fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
       fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
       fastcgi_param  PATH_INFO  $fastcgi_path_info;
       fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
       include        fastcgi_params;
    }
    location ~(favicon.ico) {
      log_not_found off;
      expires 99d;
      break;
    }
    location ~(robots.txt) {
      log_not_found off;
      expires 7d;
      break;
    }
 
    location ~* .*\.(ico|jpg|jpeg|png|gif|swf|rar|zip)$ {
      expires 7d;
      valid_referers none blocked demo.neoease.com *.google.com *.baidu.com;
    }
    access_log  /data/logs/access.log  main;
    error_log   /data/logs/error.log warn;
  }

 

posted @ 2019-02-11 15:35  巽逸  阅读(607)  评论(0)    收藏  举报