[问题] 在Apache上启动VirtualHost使用HTTP和HTTPS

楼主: wyytw (云飞扬)   2018-11-21 09:36:04
怎样在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同时运作 ??
谢谢
楼主: wyytw (云飞扬)   2018-11-21 11:02:00
httpd-2.4.6-80.el7.centos.x86_64不过我改成 *:80 和*:443就可以了谢谢ㄧ楼
作者: kdjf (我抓得到什么呢?)   2018-11-21 10:48:00
你根本没搞懂virtualhost... 怎么会用IP指定呢?然后给个发行版/版号,问题可能不在单这一个设定档

Links booklink

Contact Us: admin [ a t ] ucptt.com