Nginx配置Yii:backend&frontend

 1 #My vlson.top project
 2 #frontend
 3 server {
 4     listen       80;
 5     server_name  www.vlson.com;
 6 
 7     #charset koi8-r;
 8 
 9     set $app_root F:/vlson/advanced/frontend/web/;
10     set $project_root F:/vlson/advanced/frontend/;
11     root $app_root;
12 
13     access_log  logs/frontend.access.log  main;
14 
15     location / {
16         root   $app_root;
17         index  index.php index.html index.htm;
18         try_files $uri $uri/ /index.php?$args;
19     }
20 
21     error_page  404              /404.html;
22 
23     # redirect server error pages to the static page /50x.html
24     #
25     error_page   500 502 503 504  /50x.html;
26     location = /50x.html {
27         root   F:/vlson/frontend/web/;
28     }
29 
30     # proxy the PHP scripts to Apache listening on 127.0.0.1:80
31     #
32     #location ~ .php$ {
33     #    proxy_pass   http://127.0.0.1;
34     #}
35 
36     # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
37     #
38     location ~ .php(.*)$ {
39         root           F:/vlson/advanced/frontend/web/;
40         fastcgi_pass   127.0.0.1:9000;
41         fastcgi_index  index.php;
42         fastcgi_split_path_info  ^((?U).+.php)(/?.+)$;
43         fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
44         fastcgi_param  PATH_INFO  $fastcgi_path_info;
45         fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
46         include        fastcgi_params;
47     }
48 
49     #location ~ .*.(gif|jpg|jpeg|png|bmp|swf)${
50     #    #expires    30d;
51     #    root $project_root;
52     #}
53     #location ~ .*.(js|css)?${
54     #    root $project_root;
55     #}
56 
57     # deny access to .htaccess files, if Apache's document root
58     # concurs with nginx's one
59     #
60     #location ~ /.ht {
61     #    deny  all;
62     #}
63 }
#My vlson.top project
#backend
server {
    listen       80;
    server_name  backend.vlson.com;
    client_max_body_size 5M;

    #charset koi8-r;
    set $app_root F:/vlson/advanced/backend/web/;
    set $project_root F:/vlson/advanced/backend/;
    root $app_root;

    access_log  logs/backend.access.log  main;

    location / {
        #root   $app_root;
        index  index.php index.html index.htm;
        try_files $uri $uri/ /index.php?$args;
    }

    error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   $app_root;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ .php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ .php(.*)$ {
        root           F:/vlson/advanced/backend/web/;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_split_path_info  ^((?U).+.php)(/?.+)$;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param  PATH_INFO  $fastcgi_path_info;
        fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
        include        fastcgi_params;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /.ht {
    #    deny  all;
    #}
}