apache
# ========================================
# 配置1:1661 → 1771
# ========================================
Listen 1771
<VirtualHost *:1771>
ServerName 111.14.177.46
ServerAdmin admin@localhost
ErrorLog /var/log/httpd/pathway-proxy-1771-error.log
CustomLog /var/log/httpd/pathway-proxy-1771-access.log combined
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:1661/
ProxyPassReverse / http://127.0.0.1:1661/
ProxyTimeout 300
SetOutputFilter SUBSTITUTE
# === 删除References部分 ===
# 1. 删除References标题段落
Substitute "s|<p class=ecoparagraph> <h3>References </h3> ||i"
# 2. 删除reference段落开始标签
Substitute "s|</p> <p class='ecoparagraph reference'>||i"
# 3. 删除整个引用链接(包含所有内容)
Substitute "s|<a href=\"http://www.ncbi.nlm.nih.gov/pubmed/24225315\" class=\"CITATION-FRAME\"[^>]*>.*?</a>||i"
# 4. 删除引用内容的关键部分(备用方案)
Substitute "s|<span class='key'>Caspi14</span>: Caspi R.*?PMID: 24225315||i"
# 5. 删除最后的换行和横线(在Report Errors之前)
Substitute "s|<br><hr><a href='#' onclick|<a href='#' onclick|i"
# 禁用压缩(重要!否则无法进行文本替换)
RequestHeader unset Accept-Encoding
</VirtualHost>
# ========================================
# 配置2:1662 → 1772
# ========================================
Listen 1772
<VirtualHost *:1772>
ServerName 111.14.177.46
ServerAdmin admin@localhost
ErrorLog /var/log/httpd/pathway-proxy-1772-error.log
CustomLog /var/log/httpd/pathway-proxy-1772-access.log combined
ProxyPreserveHost On
ProxyPass / http://127.0.0.1:1662/
ProxyPassReverse / http://127.0.0.1:1662/
ProxyTimeout 300
SetOutputFilter SUBSTITUTE
# 其他替换
Substitute "s|2</a>,|2</a>|i"
Substitute "s|Caspi14</a>|</a>|i"
# === 删除References部分 ===
# 1. 删除References标题段落
Substitute "s|<p class=ecoparagraph> <h3>References </h3> ||i"
# 2. 删除reference段落开始标签
Substitute "s|</p> <p class='ecoparagraph reference'>||i"
# 3. 删除整个引用链接
Substitute "s|<a href=\"http://www.ncbi.nlm.nih.gov/pubmed/24225315\" class=\"CITATION-FRAME\"[^>]*>.*?</a>||i"
# 4. 删除引用内容(备用)
Substitute "s|<span class='key'>Caspi14</span>: Caspi R.*?PMID: 24225315||i"
# 5. 删除最后的换行和横线
Substitute "s|<br><hr><a href='#' onclick|<a href='#' onclick|i"
# 禁用压缩
RequestHeader unset Accept-Encoding
</VirtualHost>
应用配置
bash
# 1. 备份原配置
cp /etc/httpd/conf.d/pathway-proxy.conf /etc/httpd/conf.d/pathway-proxy.conf.backup
# 2. 编辑配置文件
vim /etc/httpd/conf.d/pathway-proxy.conf
# 粘贴上面的完整配置
# 3. 测试配置语法
httpd -t
# 4. 如果显示 "Syntax OK",重启Apache
systemctl restart httpd
# 5. 检查服务状态
systemctl status httpd
# 6. 查看日志(如果有问题)
tail -f /var/log/httpd/pathway-proxy-1771-error.log
如果上述方案还是不行,使用这个增强版:
apache
# 增加缓冲区大小,支持更长的行
SubstituteMaxLineLength 1048576
# 更激进的删除方式
Substitute "s|<h3>References</h3>||i"
Substitute "s|class='ecoparagraph reference'|style='display:none'|i"
Substitute "s|Caspi14||i"
Substitute "s|class=\"CITATION-FRAME\"|style=\"display:none\"|i"