配置文件: vhosts.conf,具体配置代码如下:
server {
listen 80;
server_name pc.localcndzys.com;
index index.html index.htm index.php;
root "D:/phpstudy_pro/WWW/cndzys_special";
set $yii_root "D:/phpstudy_pro/WWW/cndzys_special";
location ~ ^/(shicai|pianfang|jijie|zhongyao|import|foodPrase|foodcalories|baojian|manage|ask|hot|app|yunchan|tsys|bk|zt|joke|mobile|caipu|xiaochi|techan|specialapi|yingyangshi|mip|map|dietitian)/(css|js|images|shicai_images|makeview)/ {
root "D:/phpstudy_pro/WWW/cndzys_special";
expires 30d;
rewrite ^/(shicai|pianfang|jijie|zhongyao|import|foodPrase|foodcalories|baojian|manage|ask|hot|app|yunchan|zt|disease|joke|mobile|tsys|bk|caipu|xiaochi|techan|specialapi|yingyangshi|makeview|mip|map)/(.+)$ /$2 break;
}
location ~ ^/(js|css|images)/? {
root "D:/phpstudy_pro/WWW/cndzys_special";
rewrite ^/(.+)$ /$1 break;
}
location / {
try_files $uri $uri/ /index.php?$args;
#autoindex on;
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9003;
fastcgi_index mindex.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;
}
}
2. hosts文件:最后一行 加入配置域名:
127.0.0.1 pc.localcndzys.com