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

  

原文地址:https://www.cnblogs.com/xiongwei89/p/3725394.html