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静态化,把需要伪静态化的打上勾。

  • 相关阅读:
    SpringBoot Maven项目 Helloworld 测试
    Oracle client安装教程
    quartz定时任务时间设置
    maven导出项目依赖的jar包
    Java 集合类
    Webservice客户端动态调用服务端功能方法
    使用Eclipse自带的Axis1插件生成Web Service服务端客户端
    SpringBatch Sample (五)(复合格式文件的读、多文件的写)
    Mysql性能分析
    设置nginx中文件上传的大小限制度
  • 原文地址:https://www.cnblogs.com/conan304/p/2178161.html
Copyright © 2011-2022 走看看