目前共有10篇帖子。 字體大小:較小 - 100% (默認)▼  內容轉換:港澳繁體▼
 
點擊 回復
483 9
關於centos8自帶的apache2.4開啟https後,XP系統的IE8無法顯示網頁的問題
一派掌門 二十級
1樓 發表于:2024-4-3 17:47
經檢驗,是因為系統的apache和openssl版本太高導致的。
禁用系統默認的apache2.4,自己重新源碼編譯安裝一套openssl-1.0.1f+apache2.2.23+php7.1.2即可。
跟update-crypto-policies沒有關係,可保持默認的DEFAULT狀態。
一派掌門 二十級
2樓 發表于:2024-4-3 17:49
centos7自帶的apache就沒問題,xp ie8可以正常訪問https。建議使用centos7系統。
如果系統沒法換,只能用centos8的話,那就禁用系統自帶的apache,自己單獨編譯一套低版本的openssl apache和php。不需要調整其他任何設置。
 
一派掌門 二十級
3樓 發表于:2024-4-3 17:58
【具體操作步驟】
禁用系統自帶的apache2.4,並禁止開機自啟動:
sudo systemctl stop httpd
sudo systemctl disable httpd

安裝低版本openssl:
cd ~
mkdir temp
cd temp
wget https://www.openssl.org/source/old/1.0.1/openssl-1.0.1f.tar.gz
tar xf openssl-1.0.1f.tar.gz
cd openssl-1.0.1f/
./config --prefix=/opt/openssl-1.0.1f shared
make
sudo make install_sw

在/etc/ld.so.conf.d文件夾中新建一個mynewssl.conf文件,內容為/opt/openssl-1.0.1f/lib。
然後執行sudo ldconfig。

安裝低版本apache2.2:
wget https://archive.apache.org/dist/httpd/httpd-2.2.23.tar.gz
tar xf httpd-2.2.23.tar.gz
cd httpd-2.2.23
./configure --prefix=/opt/httpd-2.2.23 --enable-deflate --enable-expires --enable-heads --with-mpm-worker --enable-rewrite --enable-so --with-included-apr --enable-ssl --with-ssl=/opt/openssl-1.0.1f --enable-mods-shared=all
make
sudo make install

打開/opt/httpd-2.2.23/conf/httpd.conf,將
Include conf/extra/httpd-ssl.conf
取消註釋。

打開/opt/httpd-2.2.23/conf/extra/httpd-ssl.conf,正確配置證書文件路徑,如:
SSLCertificateFile    /etc/pki/tls/certs/localhost.crt
SSLCertificateKeyFile /etc/pki/tls/private/localhost.key

啟動新安裝的apache2:
sudo /opt/httpd-2.2.23/bin/apachectl start
經檢驗,XP系統下的IE6、IE8和win11下的edge、firefox均能正常訪問https。

新安裝一個php7:
(sudo yum install libxml2-devel libpng-devel)
wget https://www.php.net/distributions/php-7.1.2.tar.gz
tar xf php-7.1.2.tar.gz
cd php-7.1.2
./configure --prefix=/opt/php-7.1.2 --with-apxs2=/opt/httpd-2.2.23/bin/apxs --enable-mbstring --with-gd --with-mysqli --with-pdo-mysql --with-gettext --with-openssl=/opt/openssl-1.0.1f
make
sudo make install

在/opt/httpd-2.2.23/conf/httpd.conf末尾加入
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>

重啟新安裝的apache2:
sudo /opt/httpd-2.2.23/bin/apachectl restart

建立/opt/httpd-2.2.23/htdocs/info.php文件:
<?php
phpinfo();
 
一派掌門 二十級
4樓 發表于:2024-4-8 19:44
【配置虛擬主機:/home/xxx/xxx/config/xxx.conf】
NameVirtualHost *:80
NameVirtualHost *:443
<VirtualHost *:80>
  DocumentRoot "/opt/httpd-2.2.23/htdocs"
</VirtualHost>
<VirtualHost *:443>
  SSLEngine on
  SSLCertificateFile "/home/xxx/xxx/certificate/xxx.com.crt"
  SSLCertificateKeyFile "/home/xxx/xxx/certificate/xxx.com.key"
  SSLCertificateChainFile "/home/xxx/xxx/certificate/xxx.com.ca-bundle"
  DocumentRoot "/opt/httpd-2.2.23/htdocs"
</VirtualHost>
<VirtualHost *:80>
  DocumentRoot "/home/xxx/xxx"
  ServerName xxx.com
  Redirect 301 / https://xxx.com/
  <Directory "/home/xxx/xxx">
    Options -Indexes FollowSymLinks
 AllowOverride All
    Order allow,deny
 Allow from all
  </Directory>
</VirtualHost>
<VirtualHost *:443>
  SSLEngine on
  SSLCertificateFile "/home/xxx/xxx/certificate/xxx.com.crt"
  SSLCertificateKeyFile "/home/xxx/xxx/certificate/xxx.com.key"
  SSLCertificateChainFile "/home/xxx/xxx/certificate/xxx.com.ca-bundle"
  DocumentRoot "/home/xxx/xxx"
  ServerName xxx.com
  <Directory "/home/xxx/xxx">
    Options -Indexes FollowSymLinks
 AllowOverride All
    Order allow,deny
 Allow from all
  </Directory>
</VirtualHost>
寫好之後在/opt/httpd-2.2.23/conf/httpd.conf的最後一行包含一下:
Include /home/xxx/xxx/config/xxx.conf
請注意,Include的所有conf配置文件中,NameVirtualHost *:80和NameVirtualHost *:443隻允許出現一次。最好是在第一個conf裏面出現。
【測試】
訪問 http://伺服器IP位址 或 https://伺服器IP位址 ,出來的是It works!
訪問 http://xxx.com 自動跳轉到 https://xxx.com ,出來的是/home/xxx/xxx下的網站。
 
一派掌門 二十級
5樓 發表于:2024-4-10 11:20
回復4樓 @巨大八爪鱼 的內容:
【配置虛擬主機:/home/xxx/xxx/config/xxx.conf】
NameVirtualHost *:80
NameVirtualHost *:443
<Virtu...
【勘誤】
不帶ServerName的<VirtualHost *:443>不能寫在這個自定義的conf文件裏面,寫了也無效,因為和/opt/httpd-2.2.23/conf/extra/httpd-ssl.conf裏面已有的重複了,這是我在對 https://IP位址 做JkMount的時候發現的。
把自定義配置文件裏面的不帶ServerName的<VirtualHost *:443>刪除,再在/opt/httpd-2.2.23/conf/extra/httpd-ssl.conf裏面已有的不帶ServerName的<VirtualHost *:443>裏面添加JkMount /*.jsp worker1,就可以成功訪問 https://IP位址/test.jsp 了。
 
一派掌門 二十級
6樓 發表于:2024-4-19 21:02
今天發現具體是因為centos8系統自帶的openssl版本太高導致的。
在apache的配置文件/etc/httpd/conf.d/ssl.conf中啟用TLSv1.0。
啟用後IE8可以正常訪問https,但IE6默認情況下沒法訪問。IE6默認情況下只開啟了SSLv3,沒有開啟TLSv1.0,而CentOS8自帶的OpenSSL 1.1.1k不支持SSLv3。IE6隻有在Internet選項裏面勾選了TLS1.0才能訪問https網站。

打開apache配置文件/etc/httpd/conf.d/ssl.conf,將下面兩行
SSLCipherSuite PROFILE=SYSTEM
SSLProxyCipherSuite PROFILE=SYSTEM
修改為
SSLCipherSuite HIGH:MEDIUM:!MD5:!RC4
SSLProxyCipherSuite HIGH:MEDIUM:!MD5:!RC4
保存文件,用sudo systemctl restart httpd命令重啟apache伺服器,IE8就可以訪問https了。

提示:
(1)update-crypto-policies保持默認的「DEFAULT」狀態即可,不需要修改。
$ sudo update-crypto-policies --show
DEFAULT
(2)ssl.conf裏面下列兩行中的「-SSLv3」表示禁用SSLv3的意思。
SSLProtocol all -SSLv3
SSLProxyProtocol all -SSLv3
如果改成「+SSLv3」就表示啟用SSLv3,但是CentOS8自帶的OpenSSL 1.1.1k不支持SSLv3,修改後apache無法啟動成功。
Apr 19 11:26:32  systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit httpd.service has begun start-up
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit httpd.service has begun starting up.
Apr 19 11:26:32  httpd[366766]: AH00526: Syntax error on line 61 of /etc/httpd/conf.d/ssl.conf:
Apr 19 11:26:32  httpd[366766]: SSLv3 not supported by this version of OpenSSL
Apr 19 11:26:32  systemd[1]: httpd.service: Main process exited, code=exited, status=1/FAILURE
Apr 19 11:26:32  systemd[1]: httpd.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- The unit httpd.service has entered the 'failed' state with result 'exit-code'.
Apr 19 11:26:32  systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit httpd.service has failed.
--
-- The result is failed.

openssl命令的-ssl3選項也無法使用:
$ openssl s_client -connect localhost:443 -ssl3
s_client: Option unknown option -ssl3
s_client: Use -help for summary.
 
巨大八爪鱼:這個方法只適用於CentOS 8,在CentOS 9裏面無效。
  2024-6-24 11:07 回復
巨大八爪鱼:這個方法在Fedora 39中使用也無效。
  2024-10-31 13:22 回復
一派掌門 二十級
7樓 發表于:2024-4-24 15:20
經驗證,只要重新編譯openssl1.1.1,並且開啟sslv3的選項,就能讓openssl支持sslv3:
./config --prefix=/opt/openssl-1.1.1w enable-ssl3 enable-ssl3-method enable-weak-ssl-ciphers shared
這樣,IE6和IE8都能訪問https。
 
一派掌門 二十級
8樓 發表于:2024-4-24 15:21
回復7樓 @巨大八爪鱼 的內容:
經驗證,只要重新編譯openssl1.1.1,並且開啟sslv3的選項,就能讓openssl支持sslv3:
./config --prefix=/opt/openssl-1.1.1w...
而且還可以看到新編譯的openssl的-ssl3選項也可以用了。
 

回復帖子

內容:
用戶名: 您目前是匿名發表
驗證碼:
(快捷鍵:Ctrl+Enter)
 

本帖信息

點擊數:483 回複數:9
評論數: ?
作者:巨大八爪鱼
最後回復:巨大八爪鱼
最後回復時間:2024-10-31 13:22
 
©2010-2025 Purasbar Ver2.0
除非另有聲明,本站採用創用CC姓名標示-相同方式分享 3.0 Unported許可協議進行許可。