我尝试使用全新的干净macOS High Sierra 10.13.2配置dnsmasq
Apache版本
Server version: Apache/2.4.28 (Unix)
Server built: Oct 9 2017 19:54:20
apachectl configtest
Syntax OK
我曾经拥有它并且工作正常。但我想我错过了一些东西,因为我在localhost,127.0.0.1以及home.test或anything.test等任何项目上都收到了403禁用错误
Forbidden
You don't have permission to access / on this server.
我取消注释必要的文件以使其工作:
的httpd.conf
Include /private/etc/apache2/extra/httpd-vhosts.conf
Include /private/etc/apache2/extra/httpd-userdir.conf
LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so
LoadModule userdir_module libexec/apache2/mod_userdir.so
LoadModule php7_module libexec/apache2/libphp7.so
User absolutkarlos
Group staff
ServerName localhost
Directory > AllowOverride None
Directory > Options FollowSymLinks Multiviews Indexes
dnsmasq.conf
address=/test/127.0.0.1
absolutkarlos.conf
Directory "/Users/absolutkarlos/DOC/www/sites/"
AllowOverride All
Options Indexes MultiViews FollowSymLinks
Require all granted
的httpd-userdir.conf
UserDir sites
Include /private/etc/apache2/users/*.conf
的httpd-vhosts.conf
<Directory "/www">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Virtualhost *:80>
VirtualDocumentRoott "/Users/absolutkarlos/DOC/www/home/wwwroot"
ServerName home.test
UseCanonicalName Off
</Virtualhost>
<Virtualhost *:80>
VirtualDocumentRoot "/Users/absolutkarlos/DOC/www/sites/%1/wwwroot"
ServerName sites.test
ServerAlias *.test
UseCanonicalName Off
</Virtualhost>
error_log中
AH01630: client denied by server configuration: /Users/absolutkarlos/DOC/www/home, referer: http://home.test/
AH01630: client denied by server configuration: /Users/absolutkarlos/DOC/www/home, referer: http://localhost/
AH01630: client denied by server configuration: /Users/absolutkarlos/DOC/www/home, referer: http://127.0.0.1/
任何ping工作正常
平
ping -c 1 home.test
PING home.test (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.035 ms
--- home.test ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.035/0.035/0.035/0.000 ms