zoukankan      html  css  js  c++  java
  • nginx伪静态,终于知道是什么意思了。

    就是在宝塔每一个网站,均可以配置是否开启伪静态。

    网上也有很多的代码,今天解决了thinkcmf配置nginx伪静态,

     代码如下:

    location / {
    index index.php index.html index.htm;
    #如果请求既不是一个文件,也不是一个目录,则执行一下重写规则
    if (!-e $request_filename)
    {
    #地址作为将参数rewrite到index.php上。
    #rewrite ^/(.*)$ /index.php?s=$1;
    #若是子目录则使用下面这句,将subdir改成目录名称即可。
    rewrite ^/public/(.*)$ /public/index.php?s=$1;
    }
    error_page 405 =200 http://$host$request_uri;
    }

    location /api/ {
    index index.php index.html index.htm;
    #如果请求既不是一个文件,也不是一个目录,则执行一下重写规则
    if (!-e $request_filename)
    {
    #地址作为将参数rewrite到index.php上。
    #rewrite ^/(.*)$ /index.php?s=$1;
    #若是子目录则使用下面这句,将subdir改成目录名称即可。
    rewrite ^/api/(.*)$ /api/index.php?s=$1;
    }
    error_page 405 =200 http://$host$request_uri;
    }

    location /apiv2/ {
    index index.php index.html index.htm;
    #如果请求既不是一个文件,也不是一个目录,则执行一下重写规则
    if (!-e $request_filename)
    {
    #地址作为将参数rewrite到index.php上。
    #rewrite ^/(.*)$ /index.php?s=$1;
    #若是子目录则使用下面这句,将subdir改成目录名称即可。
    rewrite ^/apiv2/(.*)$ /apiv2/index.php?s=$1;
    }
    error_page 405 =200 http://$host$request_uri;
    }

    因为有api 和 apiv2,两个api目录均可以被访问,所以配置了多种写法。另外,访问的时候依然报错,这是因为nginx拦截了、

    加上这一句,就不会再报错了。

    error_page 405 =200 http://$host$request_uri;

  • 相关阅读:
    控制TABLE的一些属性
    windows7中各个dll文件作用和用途
    left join on and与left join on where的区别
    号外,left join比连表语句快80倍
    JS跳转语句
    [jQuery,Dojo,MooTools]
    CYQ.Data 数据框架 V3.5 开源版本发布(源码提供下载)
    Scala开发小小总结
    性能测试工具原理与架构
    joomla1.5模块开发和插件开发详解带实例
  • 原文地址:https://www.cnblogs.com/xuxiaoman/p/14619571.html
Copyright © 2011-2022 走看看