Re: ËÁË ÎÁÓÔÒÏÉÔØ ÐÒÏÓÔÏÊ rewrite

Igor Sysoev igor ÎÁ sysoev.ru
÷Ô æÅ× 9 21:35:11 MSK 2010


On Tue, Feb 09, 2010 at 07:01:10PM +0300, áÌÅËÓÁÎÄÒ óÙÔÁÒ wrote:

> õ ÍÅÎÑ ÒÁÂÏÔÁÅÔ ÎÁ ÔÁËÉÈ ÎÁÓÔÒÏÊËÁÈ:
> 
> ## WWW main server
> server {
> 	listen ip:port;
> 	server_name some_name;
> 
> 	access_log  logs/www.access.log main;
> 
> 	root   /usr/share/nginx/www;
> 
> 	location = / {
> 	    rewrite ^ /index.php/ last;
> 	}
> 
> 	location = /index.php {
> 	    rewrite ^ /index.php/ last;
> 	}
> 
> 	location / {
> 	    try_files $uri /index.php$uri;
> 	}
> 
> 	location /index.php {
> 		internal;
> 		root /usr/share/nginx/www;

root ÎÁÓÌÅÄÕÅÔÓÑ Ó ÕÒÏ×ÎÑ ÓÅÒ×ÅÒÁ.

> 		fastcgi_pass backend;
> 		fastcgi_index index.php;

fastcgi_index ÚÄÅÓØ ÎÅ ÎÕÖÅÎ.

> 		fastcgi_split_path_info         ^(.+\.php)(.*)$;
> 		fastcgi_param  SCRIPT_FILENAME  $fastcgi_script_name;
> 		fastcgi_param  PATH_INFO        $fastcgi_path_info;
> 		include	fastcgi_params;
> 	}
> 
> 	location ~* \.php$ {
> 		root /usr/share/nginx/www;

root ÎÁÓÌÅÄÕÅÔÓÑ Ó ÕÒÏ×ÎÑ ÓÅÒ×ÅÒÁ.

> 		fastcgi_pass backend;
> 		fastcgi_index index.php;

fastcgi_index ÚÄÅÓØ ÎÅ ÎÕÖÅÎ.

> 		fastcgi_split_path_info         ^(.+\.php)(.*)$;
> 		fastcgi_param  SCRIPT_FILENAME  $fastcgi_script_name;

fastcgi_split_path_info ÚÄÅÓØ ÎÅ ÎÕÖÅÎ, ÐÏÓËÏÌØËÕ path_info ÚÄÅÓØ ×ÓÅÇÄÁ
ÐÕÓÔÏÊ.

> 		fastcgi_param  PATH_INFO        $fastcgi_path_info;
> 		include	fastcgi_params;
> 	}
> }
> 
> ### end

÷ÏÔ ÐÒÁ×ÉÌØÎÙÊ ËÏÎÆÉÇ:

 	root   /usr/share/nginx/www;

 	location / {
 	    try_files $uri @php;
 	}

 	location = / {
 		fastcgi_pass backend;
 		fastcgi_param  SCRIPT_FILENAME  $document_root/index.php;
 		include	fastcgi_params;
 	}
 
 	location = /index.php {
 		fastcgi_pass backend;
 		fastcgi_param  SCRIPT_FILENAME  $document_root/index.php;
 		include	fastcgi_params;
 	}

 	location @php {
 		fastcgi_pass backend;
 		fastcgi_param  SCRIPT_FILENAME  $document_root/index.php;
 		fastcgi_param  PATH_INFO        $uri;
 		include	fastcgi_params;
 	}

 	location ~* \.php$ {
 		fastcgi_pass backend;
 		fastcgi_param  SCRIPT_FILENAME  $fastcgi_script_name;
 		include	fastcgi_params;
 	}
 
> îÕ É × ãé  $config['uri_protocol']	= 'PATH_INFO';
> 
> 9 ÆÅ×ÒÁÌÑ 2010 Ç. 18:24 ÐÏÌØÚÏ×ÁÔÅÌØ smack87 <nginx-forum at nginx.us> ÎÁÐÉÓÁÌ:
> > ÉÚÍÅÎÉÌ nginx.conf ÔÁË:
> >
> > worker_processes š1;
> >
> > events {
> > šworker_connections š1024;
> > }
> >
> >
> > http {
> > š šinclude š š š mime.types;
> > š šdefault_type šapplication/octet-stream;
> >
> > š šsendfile š š š šon;
> > š škeepalive_timeout š65;
> >
> >
> > server {
> > š š š š šlisten š š š 80;
> >
> > š š š š šserver_name šflashportal.com;
> > š š š š šcharset utf-8;
> >
> > š š š š šroot c:/dev/www/flashportal;
> >
> > š š š š šrewrite (.*) /index.php?$1 last;
> >
> > š š š š šlocation / {
> > š š š š štry_files $uri $uri/ @codeigniter;
> > š š š š š}
> >
> > š š š š šlocation @codeigniter {
> > š š š š šfastcgi_pass 127.0.0.1:9123;
> > š š š š šfastcgi_param SCRIPT_FILENAME $document_root/index.php;
> > š š š š šfastcgi_param QUERY_STRING $uri;
> > š š š š šinclude fastcgi_params1;
> > š š š š š}
> > š š}
> > }
> >
> >
> > fastcgi_params1, ÓÔÒÏËÕ Ó QUERY ÕÄÁÌÉÌ
> >
> >
> > fastcgi_param šREQUEST_METHOD š š $request_method;
> > fastcgi_param šCONTENT_TYPE š š š $content_type;
> > fastcgi_param šCONTENT_LENGTH š š $content_length;
> >
> > fastcgi_param šSCRIPT_NAME š š š š$fastcgi_script_name;
> > fastcgi_param šREQUEST_URI š š š š$request_uri;
> > fastcgi_param šDOCUMENT_URI š š š $document_uri;
> > fastcgi_param šDOCUMENT_ROOT š š š$document_root;
> > fastcgi_param šSERVER_PROTOCOL š š$server_protocol;
> >
> > fastcgi_param šGATEWAY_INTERFACE šCGI/1.1;
> > fastcgi_param šSERVER_SOFTWARE š šnginx/$nginx_version;
> >
> > fastcgi_param šREMOTE_ADDR š š š š$remote_addr;
> > fastcgi_param šREMOTE_PORT š š š š$remote_port;
> > fastcgi_param šSERVER_ADDR š š š š$server_addr;
> > fastcgi_param šSERVER_PORT š š š š$server_port;
> > fastcgi_param šSERVER_NAME š š š š$server_name;
> >
> > # PHP only, required if PHP was built with --enable-force-cgi-redirect
> > fastcgi_param šREDIRECT_STATUS š š200;
> >
> >
> > ÐÅÒÅÚÁÐÕÓÔÉÌ nginx, × ÌÏÇÁÈ ÏÛÉÂÏË ÎÅÔ:
> >
> > 2010/02/09 17:15:31 š1484#924: signal process started
> >
> >
> > îÏ ÒÁÂÏÔÁÅÔ ×ÓÅ ÔÏÞÎÏ ÔÁËÖÅ. ñ nginx.conf ÎÅÐÒÁ×ÉÌØÎÏ ÉÚÍÅÎÉÌ? íÏÖÅÔ Ñ ÞÔÏ-ÔÏ ÂÁÎÁÌØÎÏÅ ÓÐÒÁÛÉ×ÁÀ, ÎÏ ÍÁÌÏ ÞÔÏ ÐÏÎÉÍÁÀ, ÔÁË ËÁË ÎÏ×ÉÞÅË × ÜÔÏÍ ÄÅÌÅ
> >
> > Posted at Nginx Forum: http://forum.nginx.org/read.php?21,52637,52653#msg-52653
> >
> >
> > _______________________________________________
> > nginx-ru mailing list
> > nginx-ru at nginx.org
> > http://nginx.org/mailman/listinfo/nginx-ru
> >
> 
> _______________________________________________
> nginx-ru mailing list
> nginx-ru at nginx.org
> http://nginx.org/mailman/listinfo/nginx-ru

-- 
éÇÏÒØ óÙÓÏÅ×
http://sysoev.ru



ðÏÄÒÏÂÎÁÑ ÉÎÆÏÒÍÁÃÉÑ Ï ÓÐÉÓËÅ ÒÁÓÓÙÌËÉ nginx-ru