tecnodesignc/core-module

EncoreCMS 3.0 的核心模块,每个安装都需要

安装: 71

依赖者: 4

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 0

类型:encore-module

3.0.0 2024-04-26 20:21 UTC

This package is auto-updated.

Last update: 2024-09-26 21:26:13 UTC


README

# 核心模块

激活缓存系统

修改

// config/app.php

'providers' => [
    ...
    Modules\Core\Pagecache\ResponseCache\ResponseCacheServiceProvider::class,
];

此包还包含一个外观。

// config/app.php

'aliases' => [
    ...
   'ResponseCache' => Modules\Core\Pagecache\ResponseCache::class,
];

您可以使用以下命令发布配置文件

php artisan vendor:publish --provider="Modules\Core\Pagecache\ResponseCache\ResponseCacheServiceProvider"

可用的清除缓存命令

php artisan pagecache:clear

URL 重写

为了在缓存后直接服务静态文件,您需要正确配置您的 web 服务器以检查这些静态文件。

  • 对于 nginx

    更新您的 location 块的 try_files 指令以包括对 page-cache 目录的检查

    location / {
        try_files $uri $uri/ /page-cache/$uri.html /index.php?$query_string;
    }
  • 对于 apache

    打开 public/.htaccess 并在标签为 Handle Front Controller 的块之前添加以下内容

    # Serve Cached Page If Available...
    RewriteCond %{REQUEST_URI} ^/?$
    RewriteCond %{DOCUMENT_ROOT}/page-cache/pc__index__pc.html -f
    RewriteRule .? page-cache/pc__index__pc.html [L]
    RewriteCond %{DOCUMENT_ROOT}/page-cache%{REQUEST_URI}%{QUERY_STRING}.html -f
    RewriteRule . page-cache%{REQUEST_URI}.html [L]