利用Apache配置本地 自定义域名
2024-09-23 08:12:55
第一步:配置 httpd.conf
开启 虚拟主机 配置模块 去掉 " Include conf/extra/httpd-vhosts.conf " 前面的" # "
Includeconf/extra/httpd-vhosts.conf
同时添加一个Listen 80
第二步:配置 httpd-vhosts.conf
开始 将自定义的本地域名 与 web目录 关联 这里自定义了
www.lich.org
www.lich.com
www.lichina.com
这三个本地域名 (当然这三个域名 是不能远程访问的 什么原因 你懂的!)
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 用于内部的 主机的域名解析)
127.0.0.1 localhost
127.0.0.1 www.lich.org
127.0.0.1 www.lich.com
127.0.0.1 www.lichina.com
第四步:没哟了! 在浏览器上 输入 www.lichina.com www.lich.com www.lich.org 就会访问不同的本地web目录
最新文章
- 下拉列表 select-option ; select-optgroup-option
- Web端PHP代码函数覆盖率测试解决方案
- 绑定: 通过 Binding 绑定对象, 通过 x:Bind 绑定对象, 通过 Binding 绑定集合, 通过 x:Bind 绑定集合
- java之远程接口调用
- [LintCode] Continuous Subarray Sum 连续子数组之和
- AC日记——导弹拦截 洛谷 P1020 (dp+模拟)
- COGS8 备用交换机
- 08重编终极版《东邪西毒:终极版》DVD粤语中字
- ISO7816通讯协议在工控主板EM9160中的实现方案
- About Health Monitor Checks
- 使用c#解析json库
- linux source命令与export命令的区别
- python重新利用shodan API
- 报错Domain=NSCocoaErrorDomain Code=3840 ";Garbage at end.";
- linux的基本操作(shell 脚本的基础知识)
- 使用zabbix3.0.4的ICMP Ping模版实现对客户端网络状态的监控
- es6 Set 结合 Array.from 用法
- python发送邮件脚本ssl 465端口
- Entity Framework 与 LINQ to SQL
- 5分钟实现集群-NTP时间同步