mac apache 多项目 配置

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/httpd-vhosts.conf


<VirtualHost *:80>

    ServerAdmin [email protected]

    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后就开启了虚拟主机配置功能。

你可能感兴趣的:(mac apache 多项目 配置)