0514-86177077
9:00-17:00(工作日)
apache往nginx去轉,代碼端用到了$_SERVER['PATH_INFO'],對于nginx默認是不開啟pathinfo的。所以我們就要手動開啟
1,url重寫
location / { //方法1 if (!-e $request_filename) { rewrite ^/(.*)$ /index.php/$1 last; break; } } location / { //方法2 try_files $uri $uri/ /index.php$uri; }
2,pathinfo設置
location ~ .*\.(php|php5)(.*)?$ //注意這塊,配置重寫的url { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; include fastcgi.conf; }
這塊要注意,location后正則要根據重寫的url來決定。
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
標簽:淮安 樂山 安康 上海 福州 鷹潭 泰安 德宏
上一篇:Gunicorn運行與配置方法
下一篇:nginx lua集成kafka的實現方法
Copyright ? 1999-2012 誠信 合法 規范的巨人網絡通訊始建于2005年
蘇ICP備15040257號-8