Apace配置+http重定向到https

一、配置APache

  1. 打开apache安装目录下的 ssl.conf 配置以下内容
java 复制代码
<VirtualHost *:443>

# General setup for the virtual host, inherited from global configuration
#DocumentRoot "/var/www/html"
ServerName www.pwx.com
# 古籍检索系统 ,重定向到tomcat 中古籍检索系统项目
ProxyPass /record http://127.0.0.1:8080/record
ProxyPassReverse /record http://127.0.0.1:8080/record


ErrorLog logs/ssl_error_log
TransferLog logs/ssl_access_log
LogLevel warn

SSLEngine on
SSLProtocol all -SSLv2
SSLCipherSuite DEFAULT:!EXP:!SSLv2:!DES:!IDEA:!SEED:+3DES
SSLCertificateFile /etc/httpd/conf/cert/www.pwxvr.com_public.crt
SSLCertificateKeyFile /etc/httpd/conf/cert/www.pwxvr.com.key
SSLCertificateChainFile /etc/httpd/conf/cert/www.pwxvr.com_chain.crt


</VirtualHost>                  

2.打开apache安装目录下的 httpd.conf 配置以下内容

java 复制代码
<VirtualHost *:8081>
  
    DocumentRoot   /var/www/html
   
	RewriteEngine on
    RewriteCond %{SERVER_PORT} !^443$
    RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [L,R]

</VirtualHost>
相关推荐
发光小北5 小时前
EtherNet/IP 转 Modbus 网关如何应用?
网络协议·tcp/ip
我叫黑大帅5 小时前
为什么TCP是三次握手?
后端·网络协议·面试
SilentSamsara5 小时前
TCP 三次握手:连接建立失败的那些坑
运维·服务器·网络·网络协议·tcp/ip
Neolnfra6 小时前
华为ensp交换机与路由器常用命令速查手册
网络协议·ensp·华为ensp
我叫张土豆6 小时前
从 SSE 到 Streamable HTTP:AI 时代的协议演进之路
人工智能·网络协议·http
北京耐用通信9 小时前
国产优选:耐达讯自动化EtherCAT转RS232在工业协议转换中的卓越表现
人工智能·科技·物联网·网络协议·自动化
Bruce_Liuxiaowei9 小时前
顺藤摸瓜:一次从防火墙告警到设备实物的溯源实战
运维·网络·网络协议·安全
米啦啦.10 小时前
HTTP,
网络·网络协议·http
时空自由民.10 小时前
天气的所有状态
网络协议
亚林瓜子12 小时前
AWS Glue Python Shell中获取外网ip
python·tcp/ip·http·shell·aws·vpc·glue