几个月前,我按照本指南设置了我的本地网络开发环境:http://mallinson.ca/osx-web-development/ 一切都很好,直到昨天,我不知道发生了什么。我可以ping我的* .dev地址:
➜ ping -c 1 home.dev
PING home.dev (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.049 ms
--- home.dev ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.049/0.049/0.049/0.000 ms
但是当我尝试在我的浏览器中输入地址时,我得到的只是错误信息
无法访问此网站
home.dev拒绝连接。
我已经重新启动了我的电脑,dnasmq和apache一百次,我重复了链接指南中的所有步骤(我也试过这个:https://passingcuriosity.com/2013/dnsmasq-dev-osx/)但没有似乎工作。有什么想法吗?
我的设置:
http-vhosts.conf文件:
<Directory "/www">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Virtualhost *:80>
VirtualDocumentRoot "/www/home/wwwroot"
ServerName home.dev
UseCanonicalName Off
</Virtualhost>
<Virtualhost *:80>
VirtualDocumentRoot "/www/sites/%1/wwwroot"
ServerName sites.dev
ServerAlias *.dev
UseCanonicalName Off
</Virtualhost>
<Virtualhost *:80>
VirtualDocumentRoot "/www/sites/%-7+/wwwroot"
ServerName xip
ServerAlias *.xip.io
UseCanonicalName Off
</Virtualhost>
文件夹结构:
httpd -S命令:
➜ httpd -S
[Mon Jan 15 16:53:36.655895 2018] [so:warn] [pid 31755] AH01574: module php7_module is already loaded, skipping
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using olivetum.local. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
*:80 is a NameVirtualHost
default server home.dev (/private/etc/apache2/extra/httpd-vhosts.conf:7)
port 80 namevhost home.dev (/private/etc/apache2/extra/httpd-vhosts.conf:7)
port 80 namevhost sites.dev (/private/etc/apache2/extra/httpd-vhosts.conf:13)
wild alias *.dev
port 80 namevhost xip (/private/etc/apache2/extra/httpd-vhosts.conf:20)
wild alias *.xip.io
ServerRoot: "/usr"
Main DocumentRoot: "/Library/WebServer/Documents"
Main ErrorLog: "/private/var/log/apache2/error_log"
Mutex default: dir="/private/var/run/" mechanism=default
Mutex mpm-accept: using_defaults
PidFile: "/private/var/run/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="_www" id=70 not_used
Group: name="_www" id=70 not_used
dig home.dev @ 127.0.0.1命令:
➜ dig home.dev @127.0.0.1
;; QUESTION SECTION:
;home.dev. IN A
;; ANSWER SECTION:
home.dev. 0 IN A 127.0.0.1