Yaf快速起步(二)
前言
上一篇介绍了Yaf的安装,这篇来介绍一下Yaf的布局
一、Yaf的目录结构
.
|-- application #应用目录
| |-- Bootstrap.php
| |-- controllers #控制器目录
| | |-- Error.php
| | `-- Index.php
| |-- library #本地类库
| | `-- readme.txt
| |-- models #model目录
| | `-- Sample.php
| |-- plugins #插件目录
| | `-- Sample.php
| `-- views #视图目录
| |-- error
| | `-- error.phtml
| `-- index
| `-- index.phtml
|-- conf #配置文件目录
| `-- application.ini #具体的配置文件
|-- index.php #入口文件
`-- readme.txt
二、创建nginx配置文件yaf.conf
server {
listen 80;
server_name 127.0.0.1;
index index.html index.htm index.php;
root /data/www/pro/yaf/;
location ~ .*\.(php|php7)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
#伪静态规则
location /{
if (!-e $request_filename) {
rewrite ^/(.*) /index.php/$1 last;
}
}
}
三、重启或者平滑重启nginx
service nginx reload
四、访问地址 http://127.0.0.1/, 看到以下内容,说明就成功了
Hello World! I am Stranger
本作品采用《CC 协议》,转载必须注明作者和本文链接
推荐文章: