nginx配置变量访问目录

nginx配置变量访问目录

作者:LAMP小白  点击:1816  发布日期:2013-07-19 09:07:10  返回列表

网上很多帖子都是把 fastcgi_param 写死 这样造成了很多麻烦


其实配置一个变量就可以很好的解决这个问题



http {


   server {

       listen       80;

       server_name  ~^(.+)?.mio.com$;

       root '/www/mx1985.com/$1';

       set $mio_root '/www/mx1985.com/$1';

       access_log  logs/mx1985_com_access.log;

       error_log logs/mx1985_com_error.log;


       location / {

           index  index.html index.php;

       }


       error_page   500 502 503 504  /50x.html;

       location = /50x.html {

       }



       # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

       #

       location ~ .php$ {

           fastcgi_pass   127.0.0.1:9000;

           fastcgi_index  index.php;

           fastcgi_param  SCRIPT_FILENAME  $mio_root$fastcgi_script_name;

           include        fastcgi_params;

       }


   }


}




上一篇:PHP配置redis+memcache 下一篇:快递查询API
0