thinkphp nginx 地址訪問404!!!

剛剛配置好nginx能運行php的了,沒想到拉了一個tp的項目進來運行不起來,各類求助最後找到了解決的方案。php

        這段代碼是經過好友求助html

rewrite ^(.*)$ /index.php?s=$1 last;

        我發現配置好了後訪問是成功了,最後url訪問是成功可是訪問只有一個結果都是同一個頁面,最後獲得的結果是下面這段代碼nginx

rewrite ^/index.php(.*)$ /index.php?s=$1 last;

        這段代碼配合前面的代碼才能夠。因爲我以前在tp裏配置過路由覺得是路由跟nginx衝突有問題結果不是,我經過全路徑去訪問都是404.url

 

           完整的代碼配置是這樣的           .net

location / {
    root  xxx/xxx;
    index index.html index.htm index.php;
    if (!-e $request_filename) { 
        rewrite ^/index.php(.*)$ /index.php?s=$1 last;  #必須在前面
        rewrite ^(.*)$ /index.php?s=$1 last;
        break;
    }
}

            參考地址 http://www.jb100.net/html/content-28-519-1.htmlcode

相關文章
相關標籤/搜索