关于 MAC 配置 Apache2 + PHP

相关路径

  1. 默认服务路径
/Library/WebServer/Documents
  1. 配置文件路径
/etc/apache2/httpd.conf
/etc/apache2/extra/httpd-vhosts.conf

httpd.conf 配置

  1. 开启 rewrite
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
  1. 开启 php
LoadModule php7_module libexec/apache2/libphp7.so
  1. 开启 vhosts
Include /private/etc/apache2/extra/httpd-vhosts.conf

httpd-vhosts.conf 配置


 ServerName localhost
 DocumentRoot /Library/WebServer/Documents
 
 AllowOverride All
 Require all granted
 
 ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log"
 CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log" common


 ServerName namecho.io
 DocumentRoot /Users/namecho/Workspace/namecho/public
 
 AllowOverride All
 Require all granted
 
 ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log"
 CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log" common

你可能感兴趣的:(linux,apache,配置,php,rewrite)