เวลาเขียนระบบใหญ่ ๆ ที่สัมพันธ์กันหลาย domain หรือเขียน blog ที่ลูกค้าต้องการให้แต่ละตัวมี private domain เป็นภายในของตัวเอง เช่น pitt.plusmagi.internal ,dev.plusmagi.internal ถ้ามี network มาช่วย set domain ไว้เทสได้ก็ดี
หรือจะสร้าง dns ส่วนตัวไว้ใช้เฉพาะเครื่องที่เป็น server ก็จะง่ายกว่าครับ
- เปิดไฟล์ hosts โดย
- Linux หรือ macOS
- ใช้คำสั่ง
sudo nano /etc/hosts
- ใช้คำสั่ง
- Windows
- เปิดไฟล์ C:\Windows\system32\drivers\etc\hosts ถ้าเป็น windows รุ่นหลังต้องเอา read only และกำหนดสิทธิให้เขียนได้ก่อนครับ
- Linux หรือ macOS
- เพิ่ม บรรทัดโดยมีรูปแบบ เช่น
127.0.0.1 { domain name }
เช่น
127.0.0.1 plusmagi.internal ลงไป - ถ้าต้องการเพิ่ม domain อื่น ๆ ก็เพิ่มบรรทัด 127.0.0.1 domain ลงไปเรื่อย ๆ เช่น
BASH / Shell
BASH / Shell
#private internal DNS 127.0.0.1 api.plusmagi.internal 127.0.0.1 backend.plusmagi.internal 127.0.0.1 frontend.plusmagi.internal 127.0.0.1 phunsanit.plusmagi.internal 127.0.0.1 pitt.plusmagi.internal 127.0.0.1 plusmagi.internal 127.0.0.1 www.plusmagi.internal # End of private internal DNS