nginx下搭建 Yii框架

因为启用了rewrite,导致css,js,images等静态文件也定向到index.php

我不得不重定向静态文件的路径

仅供参考;

 server {
listen 80;
server_name wap.test.com; root /data1/apps/php/wap.test.com/wap;
location / {
index index.php index.html index.htm;
} # location ~ \.(js|css|png|gif|jpg|ico)$ {
# try_files $uri =404;
# }
location /css/ {
rewrite /css/(.*) /css/$1 break;
}
location /js/ {
rewrite /js/(.*) /js/$1 break;
} location /images/ {
rewrite /images/(.*) /images/$1 break;
} location ~ \.php$ {
root /data1/apps/php/wap.test.com/wap;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
} if ( !-e $request_filename ) {
rewrite ^/(.*)$ /index.php last;
}
}
上一篇:FileZilla Server超详细配置


下一篇:关于开放式CNC系统实时软件控制系统的一些简单分析