
我已經安裝並運行了 apache2。我一直在擺弄配置文件,還發現了這一點:https://httpd.apache.org/docs/2.2/vhosts/examples.html
我剛剛貼到那裡的那個網站說,要讓用戶在網頁瀏覽器上鍵入該名稱並找到您的網站,並不像在某些「apache2」設定檔中定義您的網站名稱那麼容易。還需要(該頁面上建議的)讓使用中的 dns 知道您網站的 url 是什麼以及它應該與它匹配的 ip,或者我理解的類似內容。
現在,我正在 LAN 上工作,我的 Linux 盒子向客戶端 PC 提供網路 IP 編號,並將其自身設定為預設閘道。我應該在哪裡尋找 dns 配置以便設定www.mywonderfulsite.com
-> 192.168.1.1
(linux box)
或者可以這麼說。
我希望讀到這篇文章的人能夠理解我想要實現的目標...
答案1
請參閱man dnsmasq
,其中部分內容如下:
trusty (8) dnsmasq.8.gz
Provided by: dnsmasq-base_2.68-1_i386 bug
NAME
dnsmasq - A lightweight DHCP and caching DNS server.
SYNOPSIS
dnsmasq [OPTION]...
DESCRIPTION
dnsmasq is a lightweight DNS, TFTP, PXE, router advertisement and DHCP
server. It is intended to provide coupled DNS and DHCP service to a
LAN.
Dnsmasq accepts DNS queries and either answers them from a small,
local, cache or forwards them to a real, recursive, DNS server. It
loads the contents of /etc/hosts so that local hostnames which do not
appear in the global DNS can be resolved and also answers DNS queries
for DHCP configured hosts. It can also act as the authoritative DNS
server for one or more domains, allowing local names to appear in the
global DNS.
因此,在我看來,您應該(在每個客戶端上)添加/etc/hosts
192.168.1.1 www.mywonderfulsite.com
的任何其他別名192.168.1.1
應出現在同一行,而不是單獨的行。/etc/hosts
多行相同的IP 位址會導致混亂、迷惑、沮喪,甚至令人頭暈目眩。