# Manage Custom Domains
# Introduction
When developing web applications locally, it's often necessary to add a custom domain, which makes local development simpler and closer to the configuration of the production environment.
To simplify the management of custom domains, ServBay introduced a built-in DNS server in version v1.3.4. Additionally, you can directly modify the /etc/hosts
file through ServBay, and it can take effect in real time.
Next, let's take a look at how to manage custom domains in ServBay.
# Enable the built-in DNS server (dnsmasq)
Before using the built-in DNS server, you need to first enable the dnsmasq service.
Then, click on the DNS option on the left to enter the DNS management function interface.
As an example, let's add a custom domain: servbay.cloud
, pointing to the IP: 192.168.66.6
.
After clicking the "Add" button, the DNS resolution of this custom domain is activated. Let's verify:
Through ping
, we can see that the domain name resolution we set is already effective.
# Modify the /etc/hosts
file
By modifying the /etc/hosts
file, you can also achieve custom domain name resolution.
The usage is similar to using a DNS server:
After clicking the "Add" button, the DNS resolution of this custom domain is activated. Let's verify:
Through ping
, we can see that the domain name resolution we set is already effective.
# Setting Upstream DNS Servers
ServBay supports setting upstream DNS servers. All non-custom domains will be sent to the upstream DNS server for resolution.
Under normal circumstances, this option does not need to be set, as ServBay will automatically detect the system's default settings.
Of course, you can also manually modify the upstream server to 8.8.8.8
or Cloudflare's public DNS.