A 电脑(Mac)作为服务器,B 电脑通过域名访问 (A、B 同一局域网)
A 电脑配置了虚拟域名,A 电脑 hosts 也配置了域名,所以 A 电脑可以 ip 和域名正常访问
B 电脑可以通过 A 的 IP 访问,但是通过域名则无法解析,只能 B 的 hosts 也指定域名的 IP 才可以访问,
能不能在不通过 hosts 指定的方式通过域名来访问。
配置方法参考文章
配置参数:
vim /etc/apache2/extra/httpd-vhosts.conf
<VirtualHost *:80>
ServerAdmin webmaster@rym.devci.com
DocumentRoot "/Library/WebServer/Documents"
ServerName rym.devci.com
ErrorLog "/private/var/log/apache2/rym.devci.com-error_log"
CustomLog "/private/var/log/apache2/rym.devci.com-access_log" common
<Directory "/Library/WebServer/Documents">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted
Order allow,deny
Allow from all
</Directory>
</VirtualHost>