vanillaforums伪静态规则和memcached缓存的方法

By admin at 2021-03-07 11:33 • 151次点击
admin


vanillaforums伪静态规则

.htaccess file:

# Modified
# If you modify this file then change the above line to: # Modified

<IfModule mod_rewrite.c>
    RewriteEngine On

    # Certain hosts may require the following line.
    # If vanilla is in a subfolder then you need to specify it after the /.
    # (ex. You put Vanilla in /forum so change the next line to: RewriteBase /forum)
    RewriteBase /forum

    RewriteCond %{QUERY_STRING} ^p=/?([^&]+)(&([^?]+))?$
    RewriteRule ^index\.php %1?%3 [E=X_REWRITE:1,L]

    # The basic rewrite rule.
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php [QSA,E=X_REWRITE:1,E=X_PATH_INFO:/$1,L]

    # Add the proper X_REWRITE server variable for rewritten requests.
    RewriteCond %{ENV:REDIRECT_X_REWRITE} .+
    RewriteCond %{ENV:REDIRECT_X_PATH_INFO} (.+)
    RewriteRule ^index\.php - [QSA,E=X_REWRITE:1,E=!REDIRECT_X_REWRITE,E=X_PATH_INFO:%1,E=!REDIRECT_X_PATH_INFO,L]

    # 301 redirect urls that start with index.php
    #RewriteCond %{REQUEST_METHOD} GET [NC]
    #RewriteCond %{REQUEST_URI} ^(.*?)/index\.php(.*)$
    #RewriteRule ^index\.php /%1%2 [QSA,R,L]
</IfModule>

nginx

location ~* /\.git { deny all; return 403; }
    location /build/ { deny all; return 403; }
    location /cache/ { deny all; return 403; }
    location /cgi-bin/ { deny all; return 403; }
    location /uploads/import/ { deny all; return 403; }
    location /conf/ { deny all; return 403; }
    location /tests/ { deny all; return 403; }
    location /vendor/ { deny all; return 403; }
    location ~* \.php(/|$) {
        rewrite ^ /index.php$uri last;
    }

    # Default path handling
    location / {
        try_files $uri @[vanilla](/member/vanilla) ;
    }
    
    location @[vanilla](/member/vanilla) {
        rewrite ^ /index.php$uri last;
    }

memcached 缓存,添加下面代码到网站根目录下到config.php文件中

$Configuration['Cache']['Enabled'] = true;
$Configuration['Cache']['Method'] = 'memcached';
$Configuration['memcached']['Store'] = '127.0.0.1';
$Configuration['Cache.Memcached.Option.'.Memcached::OPT_COMPRESSION] = true;
$Configuration['Cache.Memcached.Option.'.Memcached::OPT_DISTRIBUTION] = Memcached::DISTRIBUTION_CONSISTENT;
$Configuration['Cache.Memcached.Option.'.Memcached::OPT_LIBKETAMA_COMPATIBLE] = true;
$Configuration['Cache.Memcached.Option.'.Memcached::OPT_NO_BLOCK] = true;
$Configuration['Cache.Memcached.Option.'.Memcached::OPT_TCP_NODELAY] = true;
$Configuration['Cache.Memcached.Option.'.Memcached::OPT_CONNECT_TIMEOUT] = 1000;
$Configuration['Cache.Memcached.Option.'.Memcached::OPT_SERVER_FAILURE_LIMIT] = 2;


也许我的文章解决了你的问题,如果没有那很抱歉,
真诚希望您能把本站开启广告白名单,谢谢您~
联系邮箱vpslala#foxmail.com


鄙人非专业程序員,只是一个深度网瘾者,爱好折腾网络
现在百分之九十的都开启了广告过滤,更新不易.
请我喝杯咖啡吧,是我一直更新下去不删库跑路的动力.


打赏


vanillaforums, memcached, 缓存, 静态, 规则


目前尚无回复
登录 后发表评论