MCBBS Wiki:运维笔记:修订间差异

添加920字节 、​ 2023年6月19日 (星期一)
→‎Varnish:​ // Edit via Wikiplus
→‎HTTP 反向代理模式下 PURGE 请求:​ // Edit via Wikiplus
→‎Varnish:​ // Edit via Wikiplus
 
同时,指定<code>$wgInternalServer</code> 为 Wiki 的域名加 Varnish 监听端口。(如 <code>$wgInternalServer = "http://example.org:6081";</code>)。
 
并且 MediaWiki 给出的 [[mw:Manual:Varnish_caching#Configuring_Varnish|vcl 规则]]已适用于大多数情况。
===Parsoid 405===
若编辑部分页面时出现<code>连接至Parsoid/RESTBase服务器错误(HTTP 405)</code>
 
配置以下 vcl 规则至<code>sub vcl_recv</code>中,直接请求 api.php 和 rest.php 不经过缓存。
<pre>if (req.url ~ "api.php" || req.url ~ "rest.php")
return (pass);
 
即可实现 MediaWiki 在 Varnish HTTP 反向代理模式下发送 PURGE 缓存清理请求。
===移动端缓存===
如果移动版页面和桌面版使用同一个域名,添加以下规则:
<code>sub vcl_recv</code>中:
<pre> remove req.http.x-subdomain;
if(req.http.User-Agent ~ "(?i)^(lg-|sie-|nec-|lge-|sgh-|pg-)|(mobi|240x240|240x320|320x320|alcatel|android|audiovox|bada|benq|blackberry|cdm-|compal-|docomo|ericsson|hiptop|htc[-_]|huawei|ipod|kddi-|kindle|meego|midp|mitsu|mmp\/|mot-|motor|ngm_|nintendo|opera.m|palm|panasonic|philips|phone|playstation|portalmmm|sagem-|samsung|sanyo|sec-|sendo|sharp|softbank|symbian|teleca|up.browser|webos)") {
set req.http.x-subdomain = "m";
}
 
if(req.http.Cookie ~ "mf_useformat=") {
set req.http.x-subdomain = "m";
}</pre>
<code>sub vcl_hash</code>中:
<pre>hash_data(req.http.x-subdomain);</pre>
 
==本地化文字修改==
维护员、​界面管理员、​巡查员、​监督员、​小部件编辑者
3,462

个编辑