Nginx 配置,共有两个目的

  • 能够对程序进行解析

  • 能够实现静态化


我们希望访问的地址为 www.{yourdomain}.com/Hello/World 

location / {
    root   /www/html/;
    index  index.php index.html index.htm;
    if (!-f $request_filename) {
        rewrite "^/(\w{1,})/(\w{1,})/?$" /index.php?_controller=$1&_function=$2&$query_string last;
        rewrite "^/(\w{1,})/(\w{1,})/(\w{1,})/?$" /index.php?_controller=$1&_function=$2&__function=$3&$query_string last;
    }
}


发表评论
理性抒发己见,带 * 必填。