DigitalOcean ドロップレットで実行されているマルチサイト WordPress インストールがあります。Web サイトのコンテンツをキャッシュするためにApache のmod_cache
モジュールを追加しましたが、非常に奇妙な問題が発生しています。キャッシュを設定した後の最初のページ読み込みで、サイトは正常に読み込まれます。ただし、後続のページの読み込みでは、index.php が呼び出されるのではなく、ディレクトリ インデックスが取得されます。
キャッシュをクリアすると、次のページは正常に機能します。mod_cache
のレンダリングされた出力ではなく、ディレクトリ インデックスの HTML ページをキャッシュしているようですindex.php
。
これが私のサイト構成です:
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName jeremydormitzer.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/jeremydormitzer.com
ErrorLog /var/log/jeremydormitzer.com/error.log
CustomLog /var/log/jeremydormitzer.com/access.log combined
<Directory /var/www/html/jeremydormitzer.com/>
AllowOverride All
</Directory>
RewriteEngine on
LoadModule cache_module modules/mod_cache.so
<IfModule mod_cache.c>
LoadModule cache_disk_module modules/mod_cache_disk.so
<IfModule mod_cache_disk.c>
CacheEnable disk /
CacheDisable /wp-admin
</IfModule>
CacheLock on
CacheLockPath "/tmp/mod_cache-lock"
CacheLockMaxAge 5
CacheDisable "http://security.update.server/update-list/"
</IfModule>
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/qa.getpterotype.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/qa.getpterotype.com/privkey.pem
</VirtualHost>
</IfModule>
これが私のものcache_disk.conf
です:
<IfModule mod_cache_disk.c>
CacheRoot /var/cache/apache2/mod_cache_disk
CacheDirLevels 2
CacheDirLength 1
</IfModule>
そして、これが私のものapache2.conf
です:
Mutex file:${APACHE_LOCK_DIR} default
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
Include ports.conf
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/html>
AllowOverride All
</Directory>
AccessFileName .htaccess
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*.conf
ServerName 104.236.87.208
UseCanonicalName On
これで何が起こっているのか誰か知っていますか?
アップデート
リクエストに応じ.htaccess
て、ルート パスにある私のサイトのコンテンツを次に示します。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>