利用Apache配置本地 自定義域名
第一步:配置 httpd.conf
開啟 虛擬主機 配置模組 去掉 " Include conf/extra/httpd-vhosts.conf " 前面的" # "
# Virtual hosts Includeconf/extra/httpd-vhosts.conf
第二步:配置 httpd-vhosts.conf
開始 將自定義的本地域名 與 web目錄 關聯 這裡自定義了
www.royal.org
www.superapp.com
www.api.com
這三個本地域名 (當然這三個域名 是不能遠端訪問的 什麼原因 你懂的!)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
NameVirtualHost
*:80 <VirtualHost
*:80> ServerName
* DocumentRoot
D:\web\apache2.2\Apache2\htdocs </VirtualHost> <VirtualHost
*:80> ServerName
www.royal.org DocumentRoot
"D:\web\apache2.2\Apache2\htdocs\Royal" <Directory
"D:\web\apache2.2\Apache2\htdocs\Royal" > Options
Indexes FollowSymLinks AllowOverride
None Order
allow,deny Allow
from all </Directory>
</VirtualHost> <VirtualHost
*:80> ServerName
www.superapp.com DocumentRoot
"D:\web\apache2.2\Apache2\htdocs\scApp7" <Directory
"D:\web\apache2.2\Apache2\htdocs\scApp7" > Options
Indexes FollowSymLinks AllowOverride
None Order
allow,deny Allow
from all </Directory>
</VirtualHost> <VirtualHost
*:80> ServerName
www.api.com DocumentRoot
"D:\web\apache2.2\Apache2\htdocs\taobaoApi" <Directory
"D:\web\apache2.2\Apache2\htdocs\taobaoApi" > Options
Indexes FollowSymLinks AllowOverride
None Order
allow,deny Allow
from all </Directory>
</VirtualHost> |
第三步: 配置windows hosts檔案
開啟 C:\WINDOWS\system32\drivers\etc\hosts 檔案
(hosts檔案其實 就是 internet 的雛形 最早的internet 是 ARPA 用於內部的 主機的域名解析)
1
2
3
|
127.0.0.1 www.royal.org
127.0.0.1 www.superapp.com
127.0.0.1 www.api.com
|
第四步:沒喲了! 在瀏覽器上 輸入 www.api.com www.superapp.com www.royal.com 就會訪問不同的本地web目錄
相關文章
- Holer實現自定義域名訪問本地WEB應用Web
- [使用技巧] GitHub pages 自定義域名配置 httpsGithubHTTP
- GitHub Pages自定義域名Github
- Apache 新增自定義vhost 目錄,等其他配置Apache
- mac 下配置本地域名Mac
- Azure AD(六)新增自定義域名
- GitHub pages+自定義域名(騰訊雲域名)+cloudflare加速GithubCloud
- Google Cloud IAM中新增自定義域名GoCloud
- GitHub Pages 自定義域名實踐整理Github
- 通過 hosts檔案配置本地域名
- 利用Xfermode 自定義形狀ViewView
- 利用Apache的VirtualHost在本地搭建多個站點Apache
- Apache Phoenix自定義函式(UDF)實踐Apache函式
- Flutter 自定義列表以及本地圖片引用Flutter地圖
- php 自定義配置檔案PHP
- 打包策略 自定義打包配置
- 如何使用極狐GitLab 自定義 Pages 根域名Gitlab
- Apache Linkis自定義變數實踐分享Apache變數
- Apache Maven Assembly自定義打包外掛的使用ApacheMaven
- Java - Apache Mina 自定義協議通訊JavaApache協議
- samba 基本配置及自定義控制Samba
- docker官方mysql映象自定義配置DockerMySql
- C#建立自定義配置節C#
- Flutter利用註解生成可自定義的路由Flutter路由
- 怎麼利用AbstractQueuedSynchronizer實現自定義同步元件?元件
- 利用Sonar定製自定義掃描規則
- 利用CAGradientLayer自定義顏色漸變viewView
- 透過自定義域名 + SSL 的方式訪問 Amazon MQ for RabbitMQMQ
- 如何自定義終端顯示配置
- Yii自定義配置檔案存放方法
- 本地訪問虛擬機器(Vmware)環境下配置的域名虛擬機
- 【高可用HA】Apache (1) —— Mac下安裝Apache Httpd到自定義路徑(非/etc/apache2)ApacheMachttpd
- Spring Boot 自動配置的原理、核心註解以及利用自動配置實現了自定義 Starter 元件Spring Boot元件
- 如何在極狐GitLab 自定義 Pages 域名、SSL/TLS 證書GitlabTLS
- 像@Transactional一樣利用註解自定義aop切片
- Laravel 自定義配置資訊的儲存方式Laravel
- docker Redis 自定義配置檔案啟動DockerRedis
- _008_SpringBoot_自定義配置Spring Boot