CentOS7默認開啟了HTTP/2,但沒有開啟TLS1.3,以及IE6和IE8的https訪問。
開啟方法:
ssl_ciphers HIGH:!aNULL:!MD5;改為ssl_ciphers HIGH:MEDIUM:!MD5:!RC4;添加一行ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
然後sudo systemctl restart nginx重啟伺服器即可。
作者共發了8篇帖子。
![]() |
軟件包名稱:nginx-1.20.1-10.el7.x86_64
CentOS7默認開啟了HTTP/2,但沒有開啟TLS1.3,以及IE6和IE8的https訪問。 開啟方法: ssl_ciphers HIGH:!aNULL:!MD5;改為ssl_ciphers HIGH:MEDIUM:!MD5:!RC4;添加一行ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; 然後sudo systemctl restart nginx重啟伺服器即可。 |
![]() |
nginx目前已經有HTTP/3模塊了(實驗性模塊),但apache還沒做這種模塊。
|
![]() |
[oct1158@cxywxvxep temp]$ nginx -V
nginx version: nginx/1.20.1 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) built with OpenSSL 1.1.1k FIPS 25 Mar 2021 TLS SNI support enabled configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-compat --with-debug --with-file-aio --with-google_perftools_module --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_degradation_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_image_filter_module=dynamic --with-http_mp4_module --with-http_perl_module=dynamic --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_xslt_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-stream_ssl_preread_module --with-threads --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E' [oct1158@cxywxvxep temp]$ openssl version OpenSSL 1.0.2k-fips 26 Jan 2017 居然用的不是同一個openssl。。。 ![]() 巨大八爪鱼:今天突然發現這種方法失效了,sslv3不行了,ie6無法訪問https。
[查看詳情]
|
![]() |
2025年3月10日,突然發現該方法失效,IE6無法訪問https。
因為前幾天剛把/opt目錄下沒有用的自編譯的httpd2.4.59和openssl1.1.1w(支持SSLv3)刪除了。 以前nginx可能碰巧引用到了自編譯的openssl1.1.1w的庫文件,所以IE6可以正常訪問https。 現在沒有openssl1.1.1w了,nginx可能就跑去引用自身的不支持SSLv3的openssl1.1.1k了,IE6就無法訪問了。 $ nginx -V nginx version: nginx/1.20.1 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) built with OpenSSL 1.1.1k FIPS 25 Mar 2021 TLS SNI support enabled configure arguments: (略) $ openssl version OpenSSL 1.0.2k-fips 26 Jan 2017 由此可見nginx自帶了一個openssl1.1.1k,不是centos7系統裏面的那個openssl1.0.2k。 |
![]() |
【手工編譯安裝nginx(裏麵包含支持ssl3的openssl)】
cd ~ wget https://nginx.org/download/nginx-1.27.4.tar.gz tar xf nginx-1.27.4.tar.gz wget https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1w/openssl-1.1.1w.tar.gz tar xf openssl-1.1.1w.tar.gz cd nginx-1.27.4 ./configure --prefix=/opt/nginx-1.27.4 --with-http_ssl_module --with-openssl=../openssl-1.1.1w --with-openssl-opt="enable-ssl3 enable-ssl3-method enable-weak-ssl-ciphers" --with-http_v2_module make sudo make install 安裝完成後,/opt下只有一個nginx-1.27.4文件夾,沒有單獨的openssl文件夾。 查看編譯出來的nginx可執行文件的版本: $ /opt/nginx-1.27.4/sbin/nginx -V nginx version: nginx/1.27.4 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) built with OpenSSL 1.1.1w 11 Sep 2023 TLS SNI support enabled configure arguments: --prefix=/opt/nginx-1.27.4 --with-http_ssl_module --with-openssl=../openssl-1.1.1w --with-openssl-opt='enable-ssl3 enable-ssl3-method enable-weak-ssl-ciphers' --with-http_v2_module 可見openssl是被直接打包到nginx可執行文件裏面了。 【測試】 啟動:sudo /opt/nginx-1.27.4/sbin/nginx 重啟:sudo /opt/nginx-1.27.4/sbin/nginx -s reload 關閉:sudo /opt/nginx-1.27.4/sbin/nginx -s stop 【開啟https(支持IE6)】 修改/opt/nginx-1.27.4/conf/nginx.conf文件,取消註釋有listen 443的那個server塊。 把ssl_certificate和ssl_certificate_key改成自己的證書文件。 ssl_ciphers HIGH:!aNULL:!MD5;改成ssl_ciphers HIGH:MEDIUM:!MD5:!RC4; 下面加一句ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; 重啟nginx伺服器即可用IE6訪問。 【開啟http2】 server_name localhost;下面加一句http2 on; 重啟nginx伺服器。 【開機啟動(這個方法只能用於CentOS系統)】 關閉nginx伺服器:sudo /opt/nginx-1.27.4/sbin/nginx -s stop 創建/usr/lib/systemd/system/opt_nginx.service文件,內容如下: [Unit] Description=opt_nginx After=network.target [Service] Type=forking ExecStartPre=/opt/nginx-1.27.4/sbin/nginx -t ExecStart=/opt/nginx-1.27.4/sbin/nginx ExecReload=/opt/nginx-1.27.4/sbin/nginx -s reload ExecStop=/opt/nginx-1.27.4/sbin/nginx -s stop PrivateTmp=true [Install] WantedBy=multi-user.target 啟動nginx伺服器:sudo systemctl start opt_nginx 設置為開機啟動:sudo systemctl enable opt_nginx 【其他設置】 設置上傳文件的最大尺寸: http塊內,server塊外添加 # set maximum post size client_max_body_size 20m; |
![]() |
【PHP配置】
server塊的location /內: index index.html index.htm index.php; location /外的下方: include /home/oct1158/config/nginx/php-fpm.conf; php-fpm.conf文件內容: location ~* \.php$ { fastcgi_index index.php; fastcgi_pass 127.0.0.1:9000; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; } |
![]() |
對於fedora41系統,php-fpm.conf裏面的fastcgi_pass 127.0.0.1:9000;要改成
/opt/nginx-1.27.4/conf/nginx.conf裏面 這是因為fedora41系統的php-fpm服務不是用的9000端口,而是用的unix socket文件。 sudo systemctl start php-fpm |