今日行ったのはzzbをapacheからnginxに移行します。


今日は学校の先生から電話をもらいました。以前メンテナンスしていたzzbが故障したと言いました。ネットワークセンターの先生と調べて、彼らがapacheからnginxに移転したことを知りました。以前apacheはmod rewriteを使っていましたので、ルートディレクトリで使いました。httaccessファイルはrewriteを行いましたが、nginxの配置はapacheと違って、直接ウェブサイトが故障しました。
      後の解決策は実は簡単です。inxのnginx.comにserverを追加します。以下のように。
server {
	listen  80;
	server_name  test.scu.edu.com;
	index index.html index.htm index.php;
	root xxx;
	location / {
		index index.html index.htm index.php;  
		if (!-e $request_filename){  
			rewrite ^(.*)$ /index.php?s=$1 last;  
			break;
		}
		root           xxx;
		fastcgi_pass   127.0.0.1:9000;
		fastcgi_index  index.php;
		fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
		include        fastcgi_params;
	}
}
       実は肝心な点は:
if (!-e $request_filename){  
			rewrite ^(.*)$ /index.php?s=$1 last;  
			break;
		}
     ここはfastcgiですpassはunix:/tmp/php-cgi.sockで、もし127..0.1:9000なら、まだ設定が必要です。
      php-cgi-b 127.1.0.1:9000-c xxx/php.ini
      やり終えたら大丈夫!!!