AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 472340
Accepted
rwired
rwired
Asked: 2013-01-26 02:47:41 +0800 CST2013-01-26 02:47:41 +0800 CST 2013-01-26 02:47:41 +0800 CST

Apache mod_substitute 无法通过 SSL 工作

  • 772

我正在迁移一个网络服务器,并且遇到了 Apache mod_substitute 的问题。在旧服务器上一切正常,对 HTTP 和 HTTPS 请求都进行了正确的替换。

在新服务器上,仅对 HTTP 请求进行替换。新服务器具有与旧服务器相同的文件结构和相同的操作系统 (CentOS 5.6)。服务器之间的 Apache 配置存在一些差异,但我无法弄清楚可能导致问题的原因。我试过 LogLevel 调试但没有用。

一些 conf 文件以查看差异:(删除注释以节省空间)

旧服务器(有效)

conf.d/ssl.conf

LoadModule ssl_module modules/mod_ssl.so
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
<IfDefine SSL>
Listen 443
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl    .crl
SSLPassPhraseDialog  builtin
SSLSessionCache         dbm:/etc/httpd/logs/ssl_scache
SSLSessionCacheTimeout  300
SSLMutex  file:/etc/httpd/logs/ssl_mutex
</IfDefine>

新服务器(mod_substitute 不对 https:// 请求执行任何操作)

conf.d/ssl.conf

LoadModule ssl_module modules/mod_ssl.so
Listen 443
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl    .crl
SSLPassPhraseDialog  builtin
SSLSessionCache         shmcb:/var/cache/mod_ssl/scache(512000)
SSLSessionCacheTimeout  300
SSLMutex default
SSLRandomSeed startup file:/dev/urandom  256
SSLRandomSeed connect builtin
SSLCryptoDevice builtin

相关的 VHosts 部分(在两个服务器上相同),https:// 页面页面确实显示(并且证书信息是正确的),只有 mod_substitute 无法将 .com 链接转换为新服务器上的 .de 链接(而在旧服务器上它工作正常)。

<VirtualHost 10.0.0.11:443>
  SuexecUserGroup myuser myuser

  DocumentRoot /home/myuser/mydomain.de/html
  ServerName mydomain.de

  ServerAlias www.mydomain.de ftp.mydomain.de mail.mydomain.de
  ServerAdmin [email protected]

  # subdomain logic
  RewriteEngine On
  RewriteOptions inherit
  RewriteCond %{HTTP_HOST} !^www\.mydomain\.de [NC]
  RewriteCond %{HTTP_HOST} !^mydomain\.de [NC]
  RewriteCond %{HTTP_HOST} ^([A-Z0-9a-z-.]+)\.mydomain\.de [NC]
  RewriteCond %{DOCUMENT_ROOT}/%1 -d
  RewriteRule ^(.+) %{HTTP_HOST}/$1 [C]
  RewriteRule ^([0-9A-Za-z-.]+)\.mydomain\.de/?(.*)$ %{DOCUMENT_ROOT}/$1/$2 [L]

  RewriteCond %{HTTP_HOST} ^www\.([A-Z0-9a-z-.]+)\.mydomain\.de [NC]
  RewriteCond %{DOCUMENT_ROOT}/%1 -d
  RewriteRule ^(.+) %{HTTP_HOST}/$1 [C]
  RewriteRule ^www\.([0-9A-Za-z-.]+)\.mydomain\.de/?(.*)$ %{DOCUMENT_ROOT}/$1/$2 [L]
  # end subdomain logic

  LogLevel debug
  ErrorLog /home/myuser/var/mydomain.de/logs/error_ssl.log
  CustomLog /home/myuser/var/mydomain.de/logs/transfer.log combined

  # php: default  don't edit between this and the "end php" comment below
  <IfModule mod_suphp.c>
    suPHP_Engine On
    suPHP_UserGroup myuser myuser
    AddHandler x-httpd-php .php
    suPHP_AddHandler x-httpd-php .php
    suPHP_ConfigPath /home/myuser/etc
  </IfModule>

  <IfModule !mod_suphp.c>
    <IfModule mod_php5.c>
      php_admin_flag engine On
    </IfModule>
    <IfModule mod_php4.c>
      php_admin_flag engine On
    </IfModule>
  </IfModule>
  # end php

  # cgi: 1 don't edit between this and the "end cgi" comment below
  <Directory /home/myuser/mydomain.de/html>
    AllowOverride  All
  </Directory>

  <Location />
    Options +ExecCGI
  </Location>
  ScriptAlias /cgi-bin/ /home/myuser/mydomain.de/html/cgi-bin/
  # end cgi

  <IfModule mod_substitute.c>
    <Location />
      AddOutputFilterByType SUBSTITUTE text/html
      Substitute "s|http://www.mydomain.com/|http://www.mydomain.de/|niq"
      Substitute "s|http://www.mydomain.com|http://www.mydomain.de/|niq"
      Substitute "s|http://mydomain.com/|http://www.mydomain.de/|niq"
      Substitute "s|http://mydomain.com|http://www.mydomain.de/|niq"
      Substitute "s|https://www.mydomain.com/|https://mydomain.de/|niq"
      Substitute "s|https://www.mydomain.com|https://mydomain.de/|niq"
      Substitute "s|https://mydomain.com/|https://mydomain.de/|niq"
      Substitute "s|https://mydomain.com|https://mydomain.de/|niq"
    </Location>
  </IfModule>

 #.com.au is the primary (CN) certificate for all country domains (multi-domain certificate)
 SSLEngine on
  SSLCipherSuite SSLv3:HIGH:MEDIUM:!SSLv2:!ADH:!aNULL:!eNULL:!NULL:!LOW
  SSLCACertificatePath /home/myuser/var/mydomain.com.au/ssl
  SSLCertificateKeyFile /home/myuser/var/mydomain.com.au/ssl/mydomain.com.au.priv.key
  SSLCertificateFile /home/myuser/var/mydomain.com.au/ssl/mydomain.com.au.crt
  SSLCACertificateFile /home/myuser/var/mydomain.com.au/ssl/mydomain.com.au.chain.crt
  SSLOptions +ExportCertData +StrictRequire
  SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
</VirtualHost>
linux
  • 1 1 个回答
  • 3383 Views

1 个回答

  • Voted
  1. Best Answer
    rwired
    2013-01-27T04:16:24+08:002013-01-27T04:16:24+08:00

    通过将 Apache 升级到 2.2.23(它是 2.2.3)解决了这个问题。

    新服务器上的 yum repros 未启用以允许升级超过 2.2.3-76.el5.centos,在找到正确的 repro 以启用和升级后,SSL 问题已修复。这不是配置文件问题。

    • 0

相关问题

  • Linux 主机到主机迁移

  • 如何在 Linux 机器上找到有关硬件的详细信息?

  • 如何在 Linux 下监控每个进程的网络 I/O 使用情况?

  • 在 RHEL4 上修改 CUPS 中的现有打印机设置

  • 为本地网络中的名称解析添加自定义 dns 条目

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve