標籤:style blog color io ar 檔案 sp div on
server { listen 80; server_name www.funsion.com; root /www/web/funsion; index index.php; # 禁止訪問應用目錄中的php檔案 location ~* ^/application/.+\.php$ { #此目錄下的.html要允許訪問,因為靜態html緩衝也是在這個目錄下產生 return 403; } location ~* ^/application/Tpl/.+\.html$ { return 403; # 禁止訪問模板目錄下的html檔案 } # 禁止訪問ThinkPHP目錄中的檔案 location ~* ^/ThinkPHP/.+\.(php|tpl|html)$ { return 403; } location / { # ThinkPHP Rewrite, 除以上指定的靜態資源外,其它的請求才有必要進行判斷 if (!-e $request_filename){ rewrite ^/(.*)$ /index.php/$1 last; } } location ~ \.php($|/){ #配置PHP支援PATH_INFO進行URL重寫 set $script $uri; set $path_info ""; if ($uri ~ "^(.+?\.php)(/.+)$") { set $script $1; set $path_info $2; } fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fcgi.conf; fastcgi_param SCRIPT_FILENAME $document_root$script; fastcgi_param SCRIPT_NAME $script; fastcgi_param PATH_INFO $path_info; } location ~* .+\.(gif|jpg|jpeg|png|bmp|swf) { expires 7d; } location ~* .+\.(js|css) { # 緩衝一年,檔案每次修改後需要在URL中加入時間戳記,否則會讀取緩衝 expires 1y; } }
nginx配置ThinkPHP Rewrite