mac apache 多项目 配置

  • 来源:
  • 更新日期:2018-04-25

摘要:Apache的安装目录在:/etc/apache2/ sudo vi /etc/apache2/httpd.conf”,打开Apche的配置文件 在httpd.conf中找到“#Include /private/etc/apache2/extra/httpd-vhosts.conf”,去掉前面的“#”,保存并退出。 sudo vi /etc/apache2/extra/htt

Apache的安装目录在:/etc/apache2/

timg (1).jpg

sudo vi /etc/apache2/httpd.conf”,打开Apche的配置文件

在httpd.conf中找到“#Include /private/etc/apache2/extra/httpd-vhosts.conf”,去掉前面的“#”,保存并退出。

sudo vi /etc/apache2/extra/httpd-vhosts.conf

 

<VirtualHost *:80>

ServerAdmin gk@qq.com

DocumentRoot "/Library/WebServer/Documents"

ServerName gaokaos

RewriteEngine on

RewriteRule ^/l-(.+?)-(.+?)-(.+?)-(.+?).html$ /e/extend/daxue/index.php?sf=$1&ty=$2&ts=$3&page=$4&

RewriteRule ^/d-(.+?).html$ /e/extend/daxue/details.php?sid=$1

ErrorLog "/private/var/log/apache2/gk-error_log"

CustomLog "/private/var/log/apache2/gk-access_log" common

</VirtualHost>

 

 

sudo vi /etc/apache2/extra/httpd-vhosts.conf

 

127.0.0.1 gaokaos

 

运行“sudo apachectl restart”,重启Apache后就开启了虚拟主机配置功能。