1. 程式人生 > >php的yii框架

php的yii框架

php的yii框架。

這是用不同的域名配置的,但是要在一個域名裡邊實現如下需求,還沒研究出來。

釋出目錄 /alidata/txall 下邊有 callback usercenter ordercenter marketcenter 等目錄。每個目錄裡邊都有一個web 目錄,和其他的目錄。就是配置 callback.shirbility.cn 時,root 直接寫 /alidata/txall/callabck/web 直接訪問web,但是callback下邊與web同級的目錄也要能訪問到,其他的東西在web裡邊定義了,可以呼叫,在域名後邊加東西。如 callback.shirbility.cn/index 能夠呼叫web同級的目錄。 這樣的話配置如下。


server{
    listen       80;
    server_name callback.shirbility.cn;
    index index.html index.htm index.php;
    root   /alidata/txall/callback/web;

   location  /  {
     root  /alidata/txall/callback/web;
     index   index.html index.php index.htm;
    try_files $uri $uri/ /index.php$is_args$args;        # 這個配置可以實現如上的要求。root指向web,在域名後邊加東西能夠被呼叫。
}

   location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    error_page   404              /404.html;
    error_page   500 502 503 504  /50x.html;

    location = /50x.html {
        root   html;
    }
}

如上配置可以實現需求,就是將root 指向 /alidata/txall/callback/web.同時呢可以將cllback目錄下邊與web同級的目錄或檔案直接呼叫。