首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >设置为解决本地ips

设置为解决本地ips
EN

Server Fault用户
提问于 2010-12-17 01:04:52
回答 1查看 446关注 0票数 2

我有一个具有以下设置的apache。

代码语言:javascript
复制
192.168.0.105:8080/site1
192.168.0.105:8080/site2
and,
192.168.0.103/blog    

我的网络里还有另外三台电脑。2台台式机和1台膝上型计算机。

在每台电脑上,在浏览器上,我想输入一些东西,

代码语言:javascript
复制
example.com/site --> resolve to 192.168.0.105:8080/site1
example.com/site --> resolve to 192.168.0.105:8080/site2

和,

代码语言:javascript
复制
sample.com/blog --> resolve to 192.168.0.103/blog

我想要2 names......example.com和sample.com,我只想要它为网络上的每台计算机解析这些地址。我不想让它缓存公共域名供本地使用,也不希望有外部互联网访问这些网站。上面的apache运行在一个ubuntu9.04VM上,我分配了IPS。

我正按照这个指南去那里。http://ubuntuforums.org/showthread.php?t=236093

我有区域定义和反向区域定义文件的问题。我不太明白这些选择。有人能告诉我哪种选择适合我的特殊情况.

代码语言:javascript
复制
// replace example.com with your domain name. do not forget the . after the domain name!
// Also, replace ns1 with the name of your DNS server
example.com.      IN      SOA     ns1.example.com. admin.example.com. (
// Do not modify the following lines!
                                                        2006081401
                                                        28800
                                                        3600
                                                        604800
                                                        38400
 )

// Replace the following line as necessary:
// ns1 = DNS Server name
// mta = mail server name
// example.com = domain name
example.com.      IN      NS              ns1.example.com.
example.com.      IN      MX     10       mta.example.com.

// Replace the IP address with the right IP addresses.
www              IN      A       192.168.0.2
mta              IN      A       192.168.0.3
ns1              IN      A       192.168.0.1

和反向区域定义文件,

代码语言:javascript
复制
//replace example.com with yoour domain name, ns1 with your DNS server name.
// The number before IN PTR example.com is the machine address of the DNS server. in my     case, it's 1, as my IP address is 192.168.0.1.
@ IN SOA ns1.example.com. admin.example.com. (
                        20060;
                        28800; 
                        604800;
                        604800;
                        86400 
)

                     IN    NS     ns1.example.com.
1                    IN    PTR    example.com

我只是有点困惑,我宁愿对自己正在做的事情有一个更清晰的理解,也不愿尝试一堆事情。任何帮助都会很好.另外,如果我做得不对,请告诉我。耽误您时间,实在对不起。

EN

回答 1

Server Fault用户

发布于 2010-12-17 02:18:18

在您的场景(听起来像是LAN开发案例)中,我会走一条简单的道路,在您的三台本地机器上编辑/etc/hosts文件以解析到您的局域网开发服务器,而不是通过在局域网上配置bind的繁琐操作。

代码语言:javascript
复制
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost 

192.168.0.103   sample.com
192.168.0.105   example.com

您仍然会得到example.com/site1 1和/site2,因为它们是由Apache处理的。

唯一要注意的是,您必须让用户将端口添加到请求中,因为您不能在/etc/hosts中指定目标端口,或者您可以通过iptablesvhosts.conf使用一些简单的选项。

我还假设这是一个可以接受的解决方案,因为您说“我只希望它解决[网络上的三台计算机S”的这些地址“,而不是我想学习如何正确地配置绑定。

票数 1
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/213518

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档