2026.6.27号后的程序包 使用这个伪静态

包含27号的安装包升级包,伪静态如下

一、Nginx(宝塔面板)
# ============================================================
# Lume 论坛 Nginx 配置(宝塔面板)
# 说明:本配置假设根目录所有 .php 入口都用了"存根文件"自动 include 到子目录
# 存根文件示例:search.php 内容为 <?php require __DIR__ . '/pages/search.php';
# ============================================================

# ===== SEO 伪静态 =====
location ^~ /thread/ {
    rewrite ^/thread/([0-9]+)\.html$ /pages/thread.php?id=$1 last;
}
location ^~ /forum/ {
    rewrite ^/forum/([0-9]+)\.html$ /pages/forum.php?id=$1 last;
}
location ^~ /user/ {
    rewrite ^/user/([0-9]+)\.html$ /pages/user.php?id=$1 last;
}
rewrite ^/post\.html$ /pages/post.php last;
rewrite ^/search\.html$ /pages/search.php last;
rewrite ^/login\.html$ /login.php last;
rewrite ^/register\.html$ /register.php last;
rewrite ^/sitemap\.xml$ /sitemap.xml last;

# ===== PHP 处理 =====
# 宝塔自带 enable-php-XX.conf 包含 fastcgi_pass/param,避免写死 sock 路径
include enable-php-74.conf;
# 如果你 PHP 版本不是 7.4,把上面改成 enable-php-80.conf / enable-php-81.conf / enable-php-82.conf / enable-php-83.conf

# ===== 安全:禁止 uploads/data/cache 下的脚本被执行 =====
location ^~ /uploads/ {
    location ~* \.(php|php3|php4|php5|phtml|pl|py|jsp|asp|sh|cgi)$ {
        deny all;
    }
}
location ^~ /data/ {
    location ~* \.(php|php3|php4|php5|phtml|pl|py|jsp|asp|sh|cgi)$ {
        deny all;
    }
}
location ^~ /cache/ {
    location ~* \.(php|php3|php4|php5|phtml|pl|py|jsp|asp|sh|cgi)$ {
        deny all;
    }
}
location ^~ /includes/ {
    location ~* \.php$ {
        deny all;
    }
}

# ===== 静态资源缓存 =====
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
    expires 7d;
    access_log off;
    add_header Cache-Control "public";
}

二、Nginx(标准 / 非宝塔)
server {
    listen 80;
    server_name yourdomain.com www.yourdomain.com;
    root /var/www/lume;
    index index.php;

    # ===== 根目录 PHP 入口的"存根转发"说明 =====
    # 你需要为这些入口在 root 下创建同名 stub 文件(内容只有一行 require):
    # index.php login.php register.php logout.php admin.php install.php upgrade.php config.php
    # 存根文件内容:<?php require __DIR__ . '/pages/xxx.php';
    # 注意:admin.php 转发到 /admin/admin.php(不是 pages/)

    # ===== 根目录 PHP 入口转发(如果不用存根文件,而是用 try_files 转发) =====
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    # ===== 用户页 -> pages/ =====
    location ~ ^/(forum|post|thread|search|profile|user|signin|rankings|drafts|messages|notifications|recharge|uid_shop|uid_change|vip|jail|captcha|edit_thread)\.php$ {
        rewrite ^/(.+)\.php$ /pages/$1.php last;
    }

    # ===== 操作处理 -> actions/ =====
    location ~ ^/(reply|moderator_action|pin_post|move_thread|delete_attachment|thread_pay|oauth_callback|download)\.php$ {
        rewrite ^/(.+)\.php$ /actions/$1.php last;
    }

    # ===== AJAX -> api/ =====
    location ~ ^/ajax_(.+)\.php$ {
        rewrite ^/ajax_(.+)\.php$ /api/ajax_$1.php last;
    }
    location = /collector_api.php {
        rewrite ^ /api/collector_api.php last;
    }

    # ===== includes 组件 -> includes/ =====
    location ~ ^/(header|footer|copyright|ad)\.php$ {
        rewrite ^/(.+)\.php$ /includes/$1.php last;
    }

    # ===== SEO 伪静态 =====
    location ^~ /thread/ {
        rewrite ^/thread/([0-9]+)\.html$ /pages/thread.php?id=$1 last;
    }
    location ^~ /forum/ {
        rewrite ^/forum/([0-9]+)\.html$ /pages/forum.php?id=$1 last;
    }
    location ^~ /user/ {
        rewrite ^/user/([0-9]+)\.html$ /pages/user.php?id=$1 last;
    }
    rewrite ^/post\.html$ /pages/post.php last;
    rewrite ^/search\.html$ /pages/search.php last;
    rewrite ^/login\.html$ /login.php last;
    rewrite ^/register\.html$ /register.php last;
    rewrite ^/sitemap\.xml$ /sitemap.xml last;

    # ===== PHP 处理 =====
    location ~ \.php$ {
        # 如果用 PHP-FPM sock:
        fastcgi_pass unix:/run/php/php-fpm.sock;
        # 如果用 TCP:
        # fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

    # ===== 安全:禁止子目录脚本执行 =====
    location ^~ /uploads/ {
        location ~* \.(php|php3|php4|php5|phtml|pl|py|jsp|asp|sh|cgi)$ {
            deny all;
        }
    }
    location ^~ /data/ {
        location ~* \.(php|php3|php4|php5|phtml|pl|py|jsp|asp|sh|cgi)$ {
            deny all;
        }
    }
    location ^~ /cache/ {
        location ~* \.(php|php3|php4|php5|phtml|pl|py|jsp|asp|sh|cgi)$ {
            deny all;
        }
    }
    location ^~ /includes/ {
        location ~* \.php$ { deny all; }
    }

    # ===== 静态资源缓存 =====
    location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
        expires 7d;
        access_log off;
        add_header Cache-Control "public";
    }

    # ===== 拒绝敏感文件 =====
    location ~ /\.(ht|git|env) { deny all; }
}

三、Apache(.htaccess)
# Lume 论坛 .htaccess
<IfModule mod_rewrite.c>
    RewriteEngine On

    # 用户页 -> pages/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(forum|post|thread|search|profile|user|signin|rankings|drafts|messages|notifications|recharge|uid_shop|uid_change|vip|jail|captcha|edit_thread)\.php$ pages/$1.php [L,QSA]

    # AJAX -> api/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^ajax_(.+)\.php$ api/ajax_$1.php [L,QSA]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^collector_api\.php$ api/collector_api.php [L,QSA]

    # 操作处理 -> actions/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(reply|moderator_action|pin_post|move_thread|delete_attachment|thread_pay|oauth_callback|download)\.php$ actions/$1.php [L,QSA]

    # includes 组件 -> includes/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME
1 2

回复 1

倒序
管理员
活跃路人
如果觉得不好复制,下载下面的附件。里面好复制点。也更加详细
预打造一款,清爽、简洁、干净、一目了然、安全、高效、低负载的新概念纯论坛程序
登录后回复