linux – apache – 子網域設定
記錄跟主機商租用的雲端主機時,增加子網域的方式。
不進前端指定A記錄的方式
- 打開自己的 Windows 主機,尋找 C:\Windows\System32\drivers\etc\hosts 用編輯器打開,添加
IP test.domain.com
存檔
- 進入 server 的 /etc/httpd/conf/httpd.conf 添加
<VirtualHost *:80> DocumentRoot /home/w....(你的路徑) ServerName 子網域網址 </VirtualHost> <Directory "/home/w....(你的路徑)"> AllowOverride All </Directory>
AllowOverride 設定 All 將會使用 .htaccess , 若指定 none 將忽略 .htaccess
進 Server 改A紀錄
- 將主機『子網域名稱』對應你的『IP』
- 設定記錄類型:A
- 重啟動 Server Apache
- Linux 重啟指令 service httpd restart
- 通常等DNS生效更新,慢一點可能要幾小時到幾天。通常隔天再看就好了,快一點大概幾分鐘吧