相关路径
- 默认服务路径
/Library/WebServer/Documents
- 配置文件路径
/etc/apache2/httpd.conf
/etc/apache2/extra/httpd-vhosts.conf
httpd.conf 配置
- 开启 rewrite
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
- 开启 php
LoadModule php7_module libexec/apache2/libphp7.so
- 开启 vhosts
Include /private/etc/apache2/extra/httpd-vhosts.conf
httpd-vhosts.conf 配置
<VirtualHost *:80>
ServerName localhost
DocumentRoot /Library/WebServer/Documents
<Directory "/Library/WebServer/Documents">
AllowOverride All
Require all granted
</Directory>
ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log"
CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerName namecho.io
DocumentRoot /Users/namecho/Workspace/namecho/public
<Directory "/Users/namecho/Workspace/namecho/public">
AllowOverride All
Require all granted
</Directory>
ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log"
CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log" common
</VirtualHost>
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论