Nginx下fastcgi_split_path_info導致CodeIgniter配置問題


Nginx下fastcgi_split_path_info導致CodeIgniter配置問題

突然發最近又有點懶散了,很久沒有寫東西了!今天談點關於不是什么很新的問題,在nginx下配置ci框架時,由於path_info沒有設定,導致ci url無法獲取出錯,導致route出錯!對於php的很多框架,這個問題都是適用的!開始找了一些網上的 dome 基本都有問題,最后參考官方的資料才解決,不少不廢話了… 直接code….  

server {
	listen       80;
	server_name  app.i.enet.com.cn appmarket.i.enet.com.cn;
	root   /home/httpd/androidmarket;
	#index index.shtml index.html index.htm;
	autoindex on;

	#charset koi8-r;

	access_log  logs/app.access.log  main;
	error_log logs/app.error.log;
	default_type  text/plain;


	location / {
		index  index.shtml index.html index.htm;
		#rewrite ^/$ /index.php last; 
		#rewrite ^/(?!index\.php|robots\.txt|images|js|styles)(.*)$ /index.php/$1 last;
	}

	#error_page  404              /404.html;

	error_page   500 502 503 504  /50x.html;
	location = /50x.html {
		root   html;
	}

	location ~ .*\.php? {
		
		#fastcig 使用socket方式比較快...
		fastcgi_pass  unix:/tmp/nginx.socket;
		# fastcgi_pass  127.0.0.1:9000;
		# fastcgi_index index.php;
		 
		#下面只是了一些fastcgi.conf中定義的一些公共的東西 如果沒有定義請自己開啟 
		#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
		#fastcgi_param SCRIPT_NAME $real_script_name;
	 
		fastcgi_split_path_info ^(.+\.php)(.*)$; 
		#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
		fastcgi_param  PATH_INFO $fastcgi_path_info; 
		fastcgi_param  PATH_TRANSLATED $document_root$fastcgi_path_info; 
		
		# fastcgi的conf路徑
		include /usr/local/nginx/conf/fastcgi_params;

	}

	# deny access to .htaccess files, if Apache's document root
	# concurs with nginx's one
	#
	#location ~ /\.ht {
	#    deny  all;
	#}
}

官方資料:http://wiki.nginx.org/HttpFastcgiModule#fastcgi_split_path_info


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM