Nginx php-fpm fastcgi rewrite example

  1. server {  
  2.     listen       8088;  
  3.     server_name  localhost;  
  4.   
  5.     #charset koi8-r;  
  6.   
  7.     #access_log  logs/host.access.log  main;  
  8.     error_log /var/log/nginx/error.log;  
  9.   
  10.     location / {  
  11.         root   /usr/local/apache/htdocs;  
  12.         index  index.html index.htm index.php;  
  13.         rewrite ^/iot/Portalv([1-9]\.[0-9]+)/(.*)$  /trunk$1/portal/$2 last;  
  14.     }  
  15.   
  16.   
  17.     location ~ \.php$ {  
  18.         rewrite ^/iot/Portalv([1-9]\.[0-9]+)/(.*)$  /trunk$1/portal/$2 last;  
  19.   
  20.         root           /usr/local/apache/htdocs;  
  21.         fastcgi_pass   127.0.0.1:9000;  
  22.         fastcgi_index  index.php;  
  23.         fastcgi_param  SCRIPT_FILENAME  /usr/local/apache/htdocs$fastcgi_script_name;  
  24.         include        fastcgi_params;  
  25.     }  
  26.   

 
 
 

Leave a Reply

Your email address will not be published.