1. 程式人生 > >thinkphp nginx下面完美配置解決404 file not found(讓nginx支援PATHINFO路由模式)

thinkphp nginx下面完美配置解決404 file not found(讓nginx支援PATHINFO路由模式)

thinkphp nginx下面完美配置解決404 file not found - bee-factory - 部落格頻道 - CSDN.NET  

http://blog.csdn.net/learner198461/article/details/54245230

老朱親自寫的,最完美ThinkPHP Nginx 配置檔案 - ThinkPHP框架  

http://www.thinkphp.cn/topic/34380.html

server {
    listen       80;
    server_name  thinkphp.lo;
    root /var/www;
    index  index.html index.htm index.php;



    error_page  404              /404.html;
    location = /404.html {
        return 404 'Sorry, File not Found!';
    }
    error_page  500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html; # windows使用者替換這個目錄
    }

    location / {
        try_files $uri @rewrite;
    }

    location @rewrite {

        set $static 0;
        if  ($uri ~ \.(css|js|jpg|jpeg|png|gif|ico|woff|eot|svg|css\.map|min\.map)$) {
            set $static 1;
        }

        if ($static = 0) {
            rewrite ^/(.*)$ /index.php?s=/$1;
        }

    }

    location ~ /Uploads/.*\.php$ {
        deny all;
    }

    location ~ \.php/ {
       if ($request_uri ~ ^(.+\.php)(/.+?)($|\?)) { }

       fastcgi_pass 127.0.0.1:9000;
       include fastcgi_params;
       fastcgi_param SCRIPT_NAME     $1;
       fastcgi_param PATH_INFO       $2;
       fastcgi_param SCRIPT_FILENAME $document_root$1;
    }

    location ~ \.php$ {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /\.ht {
        deny  all;
    }
}

相關推薦

thinkphp nginx下面完美配置解決404 file not found(nginx支援PATHINFO路由模式)

thinkphp nginx下面完美配置解決404 file not found - bee-factory - 部落格頻道 - CSDN.NET   http://blog.csdn.net/learner198461/article/details/54245230

thinkphp nginx下面完美配置解決404 file not found

server {     listen       80;     server_name  thinkphp.lo;     root /var/www;     index  index.html index.htm index.php;     error_page 

訪問本地php檔案一直報404 file not found錯誤(已解決

環境是mac + nginx + maysql + php。 在桌面上建立了一個資料夾,路徑是/Users/wyung/Desktop/st,在st資料夾下面有html檔案和php檔案。 用nginx對這個專案分配了介面,訪問地址是http://127.0.0.1:9999/login.ht

配置yii2的路由跟TP一樣nginx支援pathinfo路由模式

原因 配置了一會兒,發現nginx配置是正確的;但是發現還是不能支援pathinfo路由的格式,真是奇怪了; 後來發現是nginx沒有載入enable-php-pathinfo.conf這個配置檔案。 直接上圖了吧: 注意載入這個配置:include e

使用HttpHanlder處理404: File not found

一:場景 出於某種理由,需要由asp.net引擎處理所有可能出現的無效URL的Request。  二:現狀 對於無效URL,一般會由IIS返回404錯誤。當然,也可以自定義Custom Error Page,但是在這種情況下,並不能處理原URL所代表的Request的資料(如

openssl/ssl.h file not found mac 完美解決

目前使用的系統MacOSX10.14; 原因:MacOSX10.11開始就沒有openssl了,用的是LibreSSL 1、首先,確定自己是否真的有安裝openssl:brew install openssl,根據提示可以自己看到結果; 至此,說明你已經安裝了openss

tp5在nginx下修改配置解決訪問問題

第一:修改nginx配置    注意:所有配置都是基於lnmp1.4的一鍵安裝環境的    根據自己的nginx配置,找到正確的fastcgi.conf,修改fastcgi_param引數將預設的路徑修改至自己的專案根目錄的上一級,注意是上級!!!3、lnmp nginx r

Mac下安裝第三方模塊報錯:‘sqlfront.h‘ file not found解決辦法

for found ins 解決辦法 第三方模塊 mssql erro ref div 1.軟件環境:     mac環境:10.11.6(15G31)     python: 3.6 2.問題:     sudo pip install pymssql 後出現下面問題:

“exec: "ssh-keygen": executable file not found in %PATH%” 問題解決

light .sh 根目錄 set art oot 保存 .bat ssh set PATH=%PATH%;C:\Program Files (x86)\Git\bin bash start.sh   將以上內容保存為start.bat,放在boot2docker根目

'boost/iterator/iterator_adaptor.hpp' file not found之xcode生成時報錯的解決方案

apt 6.0 ron 百度網盤 目錄 spa 下載 https not found xcode生成rn(0.49.3)項目的時候出現“‘boost/iterator/iterator_adaptor.hpp‘ file not found之xcode&rdqu

nginx File not found 錯誤

繼承 解決 執行 自定義404 php font add play bsp nginx File not found 錯誤 使用php-fpm解析PHP,"No input file specified","File not found"是令nginx新手頭疼

Linux系列 初識ngnix——ngnix安裝及配置表內容詳解、nginx支持並顯示國家及其城市

ngnix安裝 nginx配置表內容Nginx(engine x)是一個高性能的HTTP和反向代理服務器,也是一個IMAP/POP3/SMTP服務器。功能:1.高性能的HTTP Server,解決c10k的問題2.高性能的反向代理服務器,給網站加速3.做為LB集群的前端一個負載均衡器nginx的優勢 IO

IIS HTTP 錯誤 404.17 - Not Found 解決方法

處理 錯誤 管理 style not found itl 成功 window 需要 錯誤提示如下圖: 出現這種情況的原因通常是因為先安裝了Framework,後安裝的IIS; 運行cmd,輸入: C:\Windows\Microsoft.NET\Framewor

docker + springboot + springColud 下,項目中有配置文件,讀取出現file not found 路徑中有!的問題

path docker 讀文件 getclass str 本地調試 keys div 使用 最近在做微信支付的開發,做到退款的時候,需要使用到p12 證書,在本地調試沒問題了,打成jar 包,放入到docker 下面運行,結果出現如下的bug java.io.fileN

轉 react-native 日常報錯 'config.h' file not found 解決 方法

cd node_modules/react-native/third-party/glog-0.3.4 ../../scripts/ios-configure-glog.sh product -> clean build folder  其實執行 .sh 命令

linux 解決 " command not found: shopt "的 "~/.bashrc" 配置問題

之前使用的是 bash,自從使用 zsh 後,在執行 source ~/.bashrc 的時候出現下面的 command not found 的錯誤。 下面是錯誤資訊 /home/trsky/.bashrc:16: command not found: shopt /home/trsky/.

nginx完美支援TP5的pathinfo路由模式

寶塔面板windows-5.4.0+Nginx-1.12配置(Linux請使用寶塔面板,可以直接開啟配置檔案,然後根據這個修改,一樣的) 請完全按此順序執行,不然我也不清楚有沒有其他問題 1、通過寶塔線安裝好Nginx與其它環境 2、通過寶塔面板 新增 網站 (這一步很重要,寶塔會自動配置一些檔案,可以

nginx完美支持TP5的pathinfo路由模式

roo page pat acc 5.4 net nginx location sta 寶塔面板windows-5.4.0+Nginx-1.12配置(Linux請使用寶塔面板,可以直接打開配置文件,然後根據這個修改,一樣的) 請完全按此順序執行,不然我也不清楚有沒有其他問題

HTTP錯誤404.13 - Not Found 請求篩選模塊被配置為拒絕超過請求內容長度的請求

分享圖片 block log 上傳文件 quest 屬性設置 lse www title HTTP錯誤404.13 - Not Found 請求篩選模塊被配置為拒絕超過請求內容長度的請求,原因是Web服務器上的請求篩選被配置為拒絕該請求,因為內容長度超過配置的值(IIS

File not found: git.exe,Git pycharm 配置問題

GitHub 今天在GitHub克隆了一個爬蟲專案遇到的問題在這裡寫一下。 克隆下來的別人的專案,在pycharm開啟時報下邊錯誤: File not found: git.exe 這是因為沒有配置Git安裝路徑,pycharm找不到git.exe,進pycharm設定中配置一下就好了