XiunoBBS Nginx 配置文件 (含 Rewrite 规则)

Kevin 杂记 523 次浏览 1条评论

XiunoBBS,一个国产轻论坛程序。前些天安装试用了下(PHP 组件建议全部安上,不然运行环境容易有缺失),体验确实不错,简洁风格没有多余功能。分享个自用 Nginx Rewrite 配置文件,测试在 4.0.4 版本下工作正常,往后更高版本可能需自行评估是否还合用。

替换其中域名和 SSL 证书路径就可以使用了,默认设置了 HTTPS 重定向。其中 SSL 证书规则使用的 Certbot 工具生成。修改配置文件后别忘了运行nginx -s reload

server {
    listen       80;
    listen       [::]:80;
    listen       443 ssl http2;
    listen       [::]:443 ssl http2;
    server_name  example.com;
    return 301   https://www.example.com$request_uri;

    ssl_certificate            /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key        /etc/letsencrypt/live/example.com/privkey.pem;
    ssl_session_cache          shared:SSL:10m;
    ssl_session_timeout        5m;
    ssl_protocols TLSv1        TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers  on;
    ssl_ciphers                "ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS";
    ssl_dhparam                /etc/letsencrypt/ssl-dhparams.pem;
}

server {
    listen       80;
    listen       [::]:80;
    server_name  www.example.com;
    return 301   https://www.example.com$request_uri;
}

server {
    listen       443 ssl http2;
    listen       [::]:443 ssl http2;
    server_name  www.example.com;
    root         /var/www/example.com;
    index        index.php index.html index.htm default.php default.html default.htm;

    ssl_certificate            /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key        /etc/letsencrypt/live/example.com/privkey.pem;
    ssl_session_cache          shared:SSL:10m;
    ssl_session_timeout        5m;
    ssl_protocols TLSv1        TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers  on;
    ssl_ciphers                "ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS";
    ssl_dhparam                /etc/letsencrypt/ssl-dhparams.pem;

    location ~ [^/]\.php(/|$) {
        try_files $uri =404;
        fastcgi_pass              127.0.0.1:9000;
        fastcgi_index             index.php;
        include                   fastcgi.conf;
        fastcgi_intercept_errors  on;
    }

    rewrite "^(.*)/(.+?).htm$" $1/index.php?$2.htm last;
    if (!-e $request_filename) {
        rewrite  ^(.*)$  /index.php?s=$1  last;
    }

    location ~ .*\.(png|jpg|jpeg|gif|bmp)$ {
        expires  30d;
    }

    location ~ .*\.(js|css)?$ {
        expires  12h;
    }

    location ~ /.well-known {
        allow all;
    }

    location ~ /\. {
        deny all;
    }
}

XiunoBBS 支持的固定链接形式可查看.../conf/conf.default.php文件说明,默认是thread-create-id.htm

类似 XiunoBBS 的轻论坛国内还有不少,但更新频率 XiunoBBS 要好些。国外的则有 NodeBB(免费)、Discourse(付费)、Flarum(颜值高 & 简洁,就是更新太慢了)。

评论列表

  1. #1

    Bedroom sets Hollywood
    On portal our store customer waiting colossal assortment at price.Catalog contains purchase prices, rustic farmhouse decor data about types fittings possible alternatives complete modules. Absolutely any item furniture produced directly from factory manufacturer. Decrease quotations on cabin furniture obtained due to the absence of production retail space, for rent which necessary make payment and minimum state workers. No such costs enable to establish very affordable prices for all categories acquisitions.

发表评论

电邮地址用于 Gravatar 头像显示,不会被公开可见。