nginx rewriter配置

rewriter配置

nginx.conf配置

	server {

		 listen  80;
		 server_name 127.0.0.1;
		 index index.php;
		 root  /usr/share/nginx/html;
		 #rewrite ^/projects/BookLibrary2/public$  /projects/BookLibrary2/public/index.php;
		 #include /usr/share/sidamingzhu.conf;
		     
		 location / {
		     
		                         if (!-e $request_filename) {
		                                 rewrite ^/(.*)$ /projects/BookLibrary2/public/index.php last;
		                         }
		  }          
             
		location ~ \.php$ {            #对.php文件调用php的fastcgi.exe处理
		   #root html;
		   fastcgi_pass   127.0.0.1:9000;
		   fastcgi_index  index.php;
		   fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
		   include        fastcgi_params;
		}     

	}

}

  

fpm-php.conf需要配置監聽端口

#加在fpm-php.conf最後一行
listen = 127.0.0.1:9000

  

 

posted @ 2014-05-13 14:02  忆殇之痕  阅读(228)  评论(0编辑  收藏  举报