在Apache上啟動VirtualHost使用HTTP和HTTPS - Linux

Ula avatar
By Ula
at 2018-11-21T09:36

Table of Contents

怎樣在Apache上啟動VirtualHost使用HTTP和HTTPS同時運作

還沒使用VirtualHost的時候

A網頁已經設定好SSL Https

也可以正常使用https://server.a.com

如今要加入ㄧ個B網頁http ( 沒有用SSL ) http://server.b.com

如今想要使用VirtualHost來完成這個設定

不過沒有成功

設定檔如下

<VirtualHost 123.123.123.123:80>
# ServerAdmin [email protected]
DocumentRoot /web/server.b.com
ServerName server.b.com
<Directory "/web/server.b.com">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

<VirtualHost 123.123.123.123:443>
# ServerAdmin [email protected]
DocumentRoot /web/server.a.com
ServerName server.a.com
<Directory "/web/server.a.com">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

使用這樣的設定結果

https://server.a.com

可以顯示正確的htttps的網頁

不過http://server.b.com

則顯示的網頁不正確,會顯示出server.a.com網頁的內容,不過並沒有SSL瀏覽

而我在apache網頁看到這段問題說明

https://wiki.apache.org/httpd/FAQ#SSIs_don.27t_work_for_VirtualHosts_and.2For_user_home_directories.

SSIs don't work for VirtualHosts and/or user home directories.

This is almost always due to having some setting in your config file that sets

"Options Includes" or some other setting for your DocumentRoot but not for other

directories. If you set it inside a Directory section, then that setting will

only apply to that directory.

請問一下是否確定Apache的virtualHost並不支援http和https同時運作 ??

謝謝

--
Tags: Linux

All Comments

Tom avatar
By Tom
at 2018-11-25T07:09
你根本沒搞懂virtualhost... 怎麼會用IP指定呢?
Tracy avatar
By Tracy
at 2018-11-25T17:01
然後給個發行版/版號,問題可能不在單這一個設定檔
Lauren avatar
By Lauren
at 2018-11-27T15:58
httpd-2.4.6-80.el7.centos.x86_64
George avatar
By George
at 2018-11-29T06:39
不過我改成 *:80 和*:443就可以了
謝謝ㄧ樓

debian使用NFSv4失敗

Brianna avatar
By Brianna
at 2018-11-19T00:19
OS: Debian GNU/Linux 9.6 (stretch) x86_64 想用win10來存取linux上的檔案 但我的win10之前不知道動了什麼,不能開samba也不能用samba 所以只能用NFS了 win10的NFS Client不能用UTF-8,會亂碼 但聽說用NFSv4能用UTF-8, ...

ubuntu debian xorg xrdp安裝

Faithe avatar
By Faithe
at 2018-11-18T00:24
ubuntu 16以前xrdp一定要安裝輕量級桌面 例如xfce lxde mate https://i.imgur.com/kIam9eo.png 而且同一個使用者 連進去的session 斷線後 下次連線可能會開一個新session 找不到舊的session 現在有個新的xorg xrdp 新的登 ...

Debian接FC找不到LUN

Hedy avatar
By Hedy
at 2018-11-15T13:48
OS:Debian 9 SAN:NETAPP E2812 HBA卡:QLE2562 OS版本: rootatnode06:/# cat /etc/*-release PRETTY_NAME=and#34;Debian GNU/Linux 9 (stretch)and#34; NAME=and#34;D ...

nmap 7.70安裝問題

Charlie avatar
By Charlie
at 2018-11-14T23:28
從官網上下載的nmap 7.70 rpm包 userathostname:~/下載$ sudo rpm -ivh nmap-7.70-1.x86_64.rpm [sudo] user のパスワード: rpm: RPM should not be used directly install RPM packag ...

cluster 的使用率

Tristan Cohan avatar
By Tristan Cohan
at 2018-11-14T19:54
各位大大好: 小弟不才,對於各行業使用 cluster 比例深感興趣,也想知道,各行業在認知、追求上是 否善於使用以存在多年的技術。小弟是資訊業,協助處理客戶端的設備,發現大約不到1% 的設備有在使用cluster for application.(HA) 之所以會上來發問,是在與 HR 閒聊之於,談 ...