在CentOS 7 1804 中 配置 Apache HTTP Server 將 http 自動跳轉之 https
阿新 • • 發佈:2018-11-09
相關連結:
在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配置檔案:
[[email protected] ~]# 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)