zoukankan      html  css  js  c++  java
  • discuz X2 +Ubuntu+nginx的伪静态配置

     sudo vi /usr/local/nginx/conf/nginx.conf

    打开配置文件,找到所需要配置的server,添加伪伪静态

        server {
            listen       80;
            server_name  localhost;
            #charset koi8-r;
            #access_log  logs/host.access.log  main;
            location / {
                root   /var/www/;
                index  index.php index.html index.htm;
                rewrite ^([^\.]*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3 last;
                rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
                rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
                rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
                rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
                rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
                rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
                rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;
                rewrite ^([^\.]*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3 last;
                if (!-e $request_filename) {
                   return 404;
                   }

            } 

    重启nginx

    之后在discuz的配置管理中心打开伪静态,全局/SEO/URL静态化,把需要伪静态化的打上勾。

  • 相关阅读:
    python装饰器的wraps作用
    lambda函数和map函数
    python直接赋值、切片、浅拷贝和深拷贝
    ubuntu shell脚本出错 dash
    关于方法论和相关书籍
    如何安全的大数据量表在线进行DML操作
    mysql group by 查询非聚集列
    MongoTemplate进行增删改查
    Mockito 的用法
    一个人开始优秀的3种迹象
  • 原文地址:https://www.cnblogs.com/conan304/p/2178161.html
Copyright © 2011-2022 走看看