1. 程式人生 > >xampp構建虛擬域名【個人課程學習經驗總結,部分摘自他處,僅供學習參考】

xampp構建虛擬域名【個人課程學習經驗總結,部分摘自他處,僅供學習參考】

識別 代碼 contain sample virt 自定義 ping 定義 3.1

技術分享圖片

技術分享圖片

末尾添加:

<VirtualHost *:80>
DocumentRoot "D:\Server\xampp\htdocs\zerg\public"
ServerName z.cn
</VirtualHost>

配置環境識別路徑,緊接著配置讓電腦進行識別自定義路徑:

c:\Windows\system32\drivers\etc

技術分享圖片

hosts.txt文件夾下:

技術分享圖片

針對電腦無hosts文件解決方法:

1.自己定義新建文件,粘貼以下代碼:

# Copyright (c) 1993-2009 Microsoft Corp.

#

# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.

#

# This file contains the mappings of IP addresses to host names. Each

# entry should be kept on an individual line. The IP address should

# be placed in the first column followed by the corresponding host name.

# The IP address and the host name should be separated by at least one

# space.

#

# Additionally, comments (such as these) may be inserted on individual

# lines or following the machine name denoted by a ‘#‘ symbol.

#

# For example:

#

# 102.54.94.97 rhino.acme.com # source server

# 38.25.63.10 x.acme.com # x client host

# localhost name resolution is handled within DNS itself.

# 127.0.0.1 localhost

# ::1 localhost

127.0.0.1 z.cn

進行保存。

重啟xampp!!!

【個人使用狀況:使用谷歌瀏覽器可能效果和預期不一樣,嘗試使用火狐或其他瀏覽器對自己定義的虛擬域名進行測試】

xampp構建虛擬域名【個人課程學習經驗總結,部分摘自他處,僅供學習參考】