相关链接:
在CentOS 7 1804 中 安装 Apache HTTP Server 并 配置 腾讯云 SSL
在CentOS 7 1804 中 安装 Apache HTTP Server 并 配置 阿里云 SSL
在CentOS 1804 中的 Tomcat 9 设置 SSL( https ) 加密 (多域名加密,阿里云 SSL+ 腾讯云 SSL)
在CentOS 1804 中设置 Apache Tomcat 9.0.12 开机自启
- 编辑httpd配置文件:
[root@CentOS-x86-64-DVD-1804-Desktop ~]# vim /etc/httpd/conf/httpd.conf
- 修改说明:
找到下列内容:
修改为:<Directory "/var/www"> AllowOverride None # Allow open access: Require all granted </Directory>
<Directory "/var/www"> AllowOverride None # Allow open access: Require all granted RewriteEngine on RewriteCond "%{SERVER_PORT}" !^443$ RewriteRule "^/?(.*)" "https://%{SERVER_NAME}%{REQUEST_URI}" [L,R,NE] </Directory>
- RewriteEngine on:
开启重写 - RewriteCond "%{SERVER_PORT}" !^443$:
端口不是443(%{SERVER_PORT}:访问的端口) - RewriteRule "^/?(.*)" "https://%{SERVER_NAME}%{REQUEST_URI}" [L,R,NE]:
重定向到https(%{SERVER_NAME}%:访问的域名,%{REQUEST_URI}:请求的URI)
参考文档:http://httpd.apache.org/docs/2.4/pt-br/rewrite/remapping.html
- RewriteEngine on:
相关链接:
在CentOS 7 1804 中 安装 Apache HTTP Server 并 配置 腾讯云 SSL
在CentOS 7 1804 中 安装 Apache HTTP Server 并 配置 阿里云 SSL
在CentOS 1804 中的 Tomcat 9 设置 SSL( https ) 加密 (多域名加密,阿里云 SSL+ 腾讯云 SSL)