如果要讓一個virtual 設定同時服務 http 和 https  
預設的 apache 2.2 無法直接達到這個需求

但是可以利用 include 的功能來勉強達到這個需求
大部分共用的設定寫在 pass.tw-http.inc
有關ssl 的設定另外再獨立出一個 .inc 檔案
例如
<VirtualHost *:80>
   ServerAlias test.pass.tw
   include /usr/local/etc/apache22/extra/pass.tw-http.inc
</VirtualHost>

<VirtualHost *:443>
   SSLEngine on
   ServerAlias test.pass.tw
   include /usr/local/etc/apache22/extra/pass.tw-http.inc
   include /usr/local/etc/apache22/extra/pass.tw-https.inc
</VirtualHost>

但還是要注意
1. ServerAlias 要寫在<VirtualHost> 裡面,不可以寫在include file中
1. SSLEngine on 要寫在<VirtualHost> 裡面,不可以寫在include file中

undefined
WordPress站長練功秘笈:網站客製化、佈景主題與外掛開發的16堂課

出版社:博碩  
出版日期:2017/04/28
語言:繁體中文
定價:580元

arrow
arrow

    helloworld 發表在 痞客邦 留言(0) 人氣()