欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Mac自带Apache配置

程序员文章站 2024-01-16 21:53:58
...

修改httpd.conf

第一步:
#apache支持rewrite
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
#apache支持php7
LoadModule php7_module libexec/apache2/libphp7.so

第二步:
<Directory />
    AllowOverride All
    Require all granted
</Directory>

第三步:引入vhost
# Virtual hosts
Include /private/etc/apache2/extra/httpd-vhosts.conf

配置虚拟主机:

<VirtualHost *:80>
    DocumentRoot “/path/to/document/root/"
    ServerName  www.baidu.com
    <Directory "/path/to/document/root/">
        Options +FollowSymLinks
        IndexIgnore */*
        RewriteEngine on
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule . index.php
    </Directory>
</VirtualHost>