国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

您的位置:首頁技術文章
文章詳情頁

apache虛擬主機

瀏覽:114日期:2024-07-01 13:36:52

問題描述

最近在研究虛擬主機,然后我配置了兩個虛擬主機,如下apache虛擬主機

其中一個的ServerName設置為127.0.0.1 。然后再C盤的hosts文件里面增加apache虛擬主機

那么問題來了。我在瀏覽器直接輸入www.abc.com時候會訪問到E:/wamp/crm這個項目,為什么呢?在hosts里面www.abc.com不是對應127.0.0.1嗎,不是應該訪問E:/wamp/wamp/www這個項目嗎?然后我在瀏覽器直接輸入127.0.0.1的時候訪問的是E:/wamp/wamp/www這個項目?就是這里搞不懂。。。。請大神搭救搭救。。。。。。

問題解答

回答1:

官方文檔在此:An In-Depth Discussion of Virtual Host Matching

你這個屬于“Name-based vhost”,就看這一段好了:

If there are multiple VirtualHost directives listing the IP addressand port combination that was determined to be the best match, the'list' in the remaining steps refers to the list of vhosts thatmatched, in the order they were in the configuration file.

我來簡單翻譯,在vhost IP和端口吻合的情況下(就是你這里的*:80),apache會根據vhost配置文件中vhost的先后順序依次進行匹配.

If the connection is using SSL, the server supports Server NameIndication, and the SSL client handshake includes the TLS extensionwith the requested hostname, then that hostname is used below justlike the Host: header would be used on a non-SSL connection.Otherwise, the first name-based vhost whose address matched is usedfor SSL connections. This is significant because the vhost determineswhich certificate the server will use for the connection.

如果是SSL連接,會根據TLS握手信息里面的SNI尋找主機名。如果不支持SNI,就匹配給第一個IP和端口(這里指的還是 *:80)吻合的vhost.

If the request contains a Host: header field, the list is searched forthe first vhost with a matching ServerName or ServerAlias, and therequest is served from that vhost. A Host: header field can contain aport number, but Apache always ignores it and matches against the realport to which the client sent the request.

如果HTTP頭部有Host信息,則匹配給第一個和ServerName或者ServerAlias吻合的虛擬主機。有的時候Host會包含端口信息,Apache不會鳥這個端口。

The first vhost in the config file with the specified IP address has the highest priority and catches any request to an unknown server name, or a request without a Host: header field (such as a HTTP/1.0 request).

如果都沒匹配上,扔給第一個IP端口(指的還是你的那個*:80)吻合的vhost

你訪問的abc.com是第一個crm那個么?不是, 是127.0.0.1么(只有地址欄直接輸入127.0.0.1才算)? 不是,那就走默認的,也就是第一個crm的配置。

回答2:

個人感覺serverName沒啥用,所以你這個按優(yōu)先適配原則,按80端口就直接是第一條規(guī)則。你要真想掛倆站點,用端口號區(qū)分就好了~另外也可以看看文檔。中文文檔推薦譯者:金步國的。

回答3:

域名是用來解析為IP的,所以兩個都是127.0.0.1而你的兩個端口同樣是80,只能訪問第一個了

你把下面的的改為8080,用8080端口訪問第二個

相關文章:
主站蜘蛛池模板: 久久最新| 国产精品久久久久一区二区三区 | 久草综合在线观看 | 国产精品久久久久久 | 欧美另类孕交免费观看 | 国产深夜福利视频网站在线观看 | 有码日韩 | 欧美精品免费在线 | 国产亚洲网站 | 亚洲精品专区一区二区三区 | 亚洲www在线 | 国产高清无专砖区2021 | 国产91久久最新观看地址 | 99视频精品免视3 | 国产六区 | 91视频一区 | 全黄性高视频 | 日韩一级片在线播放 | 丝袜精品 欧美 亚洲 自拍 | 成人精品一区久久久久 | 欧美久久久久欧美一区 | 99精品免费视频 | 亚洲成年男人的天堂网 | 黄色三级网站免费 | 国产免费播放一区二区 | 国产裸体美女视频全黄 | 性做久久久久久 | 亚洲精品久久玖玖玖玖 | 久久精品夜色国产 | 一本久道久久综合中文字幕 | 九九黄色影院 | 国产成人综合精品 | 午夜性生活视频 | 成人自拍网| 91久久精品国产91久久性色tv | 亚洲精品一区二区三区在 | 国产日韩欧美 | 国产在线综合视频 | 特别福利视频在线观看 | 午夜丝袜美腿福利视频在线看 | 亚洲精品一区二区三区在线播放 |