ThinkPHP

1server{ 2 listen 80; 3 server_name test.cn; 4 index index.php; 5 root /data/wwwroot/test_tp5/public; 6 7 include thinkphp.conf; 8 9 location ~ [^/]\.php(/|$) { 10 # comment try_files $uri =404; to enable pathinfo 11 try_files $uri =404; 12 fastcgi_pass unix:/tmp/php-cgi.sock; 13 fastcgi_index index.php; 14 include fastcgi.conf; 15 #include pathinfo.conf; 16 } 17 if ($http_user_agent ~* "qihoobot|Baiduspider|Googlebot|Googlebot-Mobile|Googlebot-Image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|Yahoo! Slurp|Yahoo! Slurp China|YoudaoBot|Sosospider|Sogou spider|Sogou web s 18pider|MSNBot|ia_archiver|Tomato Bot") { 19 return 403; 20 } 21 error_log /home/wwwlogs/test.cn.error.log; 22 access_log /home/wwwlogs/test.cn.access.log; 23}

thinkphp.conf

1 location / { 2 if (!-e $request_filename){ 3 rewrite ^(.*)$ /index.php?s=/$1 last; 4 break; 5 } 6 }

fastcgi.conf

1fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 2fastcgi_param QUERY_STRING $query_string; 3fastcgi_param REQUEST_METHOD $request_method; 4fastcgi_param CONTENT_TYPE $content_type; 5fastcgi_param CONTENT_LENGTH $content_length; 6 7fastcgi_param SCRIPT_NAME $fastcgi_script_name; 8fastcgi_param REQUEST_URI $request_uri; 9fastcgi_param DOCUMENT_URI $document_uri; 10fastcgi_param DOCUMENT_ROOT $document_root; 11fastcgi_param SERVER_PROTOCOL $server_protocol; 12fastcgi_param HTTPS $https if_not_empty; 13 14fastcgi_param GATEWAY_INTERFACE CGI/1.1; 15fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; 16 17fastcgi_param REMOTE_ADDR $remote_addr; 18fastcgi_param REMOTE_PORT $remote_port; 19fastcgi_param SERVER_ADDR $server_addr; 20fastcgi_param SERVER_PORT $server_port; 21fastcgi_param SERVER_NAME $server_name; 22 23# PHP only, required if PHP was built with --enable-force-cgi-redirect 24fastcgi_param REDIRECT_STATUS 200; 25 26 27server 28{ 29 listen 80; 30 #域名 31 server_name youzuoapi.osd-asia.com; 32 index index.php index.html index.htm default.php default.htm default.html;   33 #项目目录 34 root /www/web/youzuo/public; 35 36 location / { 37 if ( -f $request_filename) { 38 break; 39 } 40 41 if ( !-e $request_filename) { 42 rewrite ^/(.*)$ /index.php/$1 last; 43 break; 44 } 45 } 46 #后台重写规则 47 location /admin/ { 48 if ( !-e $request_filename) { 49 rewrite ^/admin/(.*)$ /admin/index.php/$1 last; 50 break; 51 } 52 } 53 54 location ~ \.php { 55 set $script $uri; 56 set $path_info ""; 57 if ($uri ~ "^(.+\.php)(/.+)") { 58 set $script $1; 59 set $path_info $2; 60 } 61 62 include fastcgi_params; 63 try_files $uri =404; 64 fastcgi_pass 127.0.0.1:9000; 65 #fastcgi_pass unix:/tmp/php-cgi.sock; 66 fastcgi_index index.php; 67 fastcgi_param PATH_INFO $path_info; 68 fastcgi_param SCRIPT_FILENAME $document_root$script; 69 fastcgi_param SCRIPT_NAME $script; 70 } 71 access_log /www/source/nginx/logs/www_access.log; 72 error_log /www/source/nginx/logs/www.error.log; 73}

fastcgi_params

1fastcgi_param QUERY_STRING $query_string; 2fastcgi_param REQUEST_METHOD $request_method; 3fastcgi_param CONTENT_TYPE $content_type; 4fastcgi_param CONTENT_LENGTH $content_length; 5 6fastcgi_param SCRIPT_NAME $fastcgi_script_name; 7fastcgi_param REQUEST_URI $request_uri; 8fastcgi_param DOCUMENT_URI $document_uri; 9fastcgi_param DOCUMENT_ROOT $document_root; 10fastcgi_param SERVER_PROTOCOL $server_protocol; 11fastcgi_param HTTPS $https if_not_empty; 12 13fastcgi_param GATEWAY_INTERFACE CGI/1.1; 14fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; 15 16fastcgi_param REMOTE_ADDR $remote_addr; 17fastcgi_param REMOTE_PORT $remote_port; 18fastcgi_param SERVER_ADDR $server_addr; 19fastcgi_param SERVER_PORT $server_port; 20fastcgi_param SERVER_NAME $server_name; 21 22# PHP only, required if PHP was built with --enable-force-cgi-redirect 23fastcgi_param REDIRECT_STATUS 200;
点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

2020年前端实用代码段,为你的工作保驾护航

有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )

Nginx 反向代理Springboot oAuth https配置方案

Nginx配置方案server{listen80;server_namewww.yourname.com;rewrite^(.)$https://${server_name}$1permanent;}server{

thinkphp5 + vue nginx配置

thinkphp5vue配置server{listen80;listen:::80;Forhttpslisten443ssl;listen:::443ssl;ssl_c