問題及原理可參考:http://www.laruence.com/2009/11/13/1138.html
如果是用lnmp腳本一鍵安裝的開發環境,可以透過以下方式開戶pathinfo:
1、註解nginx.conf中的try_files(因為跟pathinfo.conf中的重複了),開啟pathinfo.conf設定:
<span>1</span> location ~ [^/]\.php(/|<span>$) </span><span>2</span> <span>{ </span><span>3</span> # comment try_files $uri =<span>404</span><span>; to enable pathinfo </span><span>4</span> #try_files $uri =<span>404</span><span>; </span><span>5</span> fastcgi_pass unix:/tmp/php-<span>cgi.sock; </span><span>6</span> <span> fastcgi_index index.php; </span><span>7</span> <span> include fastcgi.conf; </span><span>8</span> <span> include pathinfo.conf; </span><span>9</span> }
即註解掉第4行,開啟第8行。
2、重啟nginx服務:
nginx -s reload
以上就介紹了lnmp一鍵安裝環境中nginx開啟pathinfo,包含了方面的內容,希望對PHP教學有興趣的朋友有幫助。