zoukankan      html  css  js  c++  java
  • linux中安装typecho的pathinfo配置

    最近,我安装typecho,安装完之后发现,只有首页能够访问,其他的页面报404错误

    后来发现时nginx默认情况下不支持pathinfo模式,于是我查找一下资料。终于得到解决。

    我的nginx.conf配置如下:

    server
    {
     listen       80;
     server_name  47.93.101.33;
     server_name  www.xialan.tech;
     index  index.php index.html;
     root  /var/www/html/typecho/build;
    
     location ~ .*.php(/.*)*$
     {
      #fastcgi_pass  unix:/tmp/php-cgi.sock;
      fastcgi_pass  127.0.0.1:9000;
      fastcgi_index index.php;
      #  limit_conn one 20;
     #设置PATH_INFO,注意fastcgi_split_path_info已经自动改写了fastcgi_script_name变量,
     #后面不需要再改写SCRIPT_FILENAME,SCRIPT_NAME环境变量,所以必须在加载fastcgi.conf之前设置
     # fastcgi_split_path_info  ^(.+.php)(/.*)$;
     # fastcgi_param  PATH_INFO $fastcgi_path_info;
     # fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;
     set $path_info "";
     set $real_script_name $fastcgi_script_name;
     if ($fastcgi_script_name ~ "^(.+?.php)(/.+)$") {
        set $real_script_name $1;
        set $path_info $2;
      }
     fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
     fastcgi_param SCRIPT_NAME $real_script_name;
     fastcgi_param PATH_INFO $path_info;
    
    # include fastcgi_params;
         include fastcgi.conf;
     }
    
     location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
     {
     expires     3d;
     }
    
     location ~ .*.(js|css)?$
     {
     expires     1h;
     }
    
    }

    参考:http://docs.typecho.org/servers

  • 相关阅读:
    获取yyyymmdd hh:ii:ss形式的日期时间
    详解SQL Server如何链接远程MySQL
    SET QUERY_GOVERNOR_COST_LIMIT
    STR函数将数字数据转换成字符数据
    表的转置
    C#中时间的Ticks属性
    创建CheckBox样式的下拉列表
    HTML DOM whiteSpace 属性
    TRUNCATE TABLE
    NFS服务配置.
  • 原文地址:https://www.cnblogs.com/wuheng1991/p/8315691.html
Copyright © 2011-2022 走看看