我正在考虑编写一些逻辑到我的应用程序,以便它可以将静态页面内容写入s3或某个CDN,并主要从那里开始。 但是我不确定这是否可能。
例如,我有site.com/something,它应该首先在cdn中查找,如果不存在,则从varnishcaching或nginx / php-fpm提供服务。 这个想法是把stream量从服务器上拿走。
这是一个可能的情况?
在drupal中,我看到了一个模块来做到这一点 。 它将静态文件caching存储在磁盘中,并在其中存在。 下面是他们提供的图表。
他们问下面的.htaccess除外
# RewriteBase / ### BOOST START ### # Allow for alt paths to be set via htaccess rules; allows for cached variants (future mobile support) RewriteRule .* - [E=boostpath:normal] # Caching for anonymous users # Skip boost IF not get request OR uri has wrong dir OR cookie is set OR request came from this server OR https request RewriteCond %{REQUEST_METHOD} !^(GET|HEAD)$ [OR] RewriteCond %{REQUEST_URI} (^/(admin|cache|misc|modules|sites|system|openid|themes|node/add|comment/reply))|(/(edit|user|user/(login|password|register))$) [OR] RewriteCond %{HTTPS} on [OR] RewriteCond %{HTTP_COOKIE} DRUPAL_UID [OR] RewriteCond %{ENV:REDIRECT_STATUS} 200 RewriteRule .* - [S=3] # GZIP RewriteCond %{HTTP:Accept-encoding} !gzip RewriteRule .* - [S=1] RewriteCond %{DOCUMENT_ROOT}/cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html\.gz -s RewriteRule .* cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html\.gz [L,T=text/html,E=no-gzip:1] # NORMAL RewriteCond %{DOCUMENT_ROOT}/cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html -s RewriteRule .* cache/%{ENV:boostpath}/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html [L,T=text/html] ### BOOST END ### # Rewrite URLs of the form 'x' to the form 'index.php?q=x'. # Pass all requests not referring directly to files in the filesystem to # index.php. Clean URLs are handled in drupal_environment_initialize(). RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^ index.php [L]
我不完全知道这是什么,但相当明白,用户必须打这个Apache。 能有更好的解决scheme吗? 我可能在这里觉得很愚蠢,但是想要探索可能性。