首页 > tools > apache > > 正文

Set up Apache in OS X 10.11 El Capitan 配置详解

发布人:zhoulujun@live.cn    点击:

mac 升级了El Capitan然后,尼玛apache居然不能用了……平时,用nginx,也管着玩意……然后,百度下,……说把httpd conf pre-update 替

mac 升级了 El Capitan

然后,尼玛apache居然不能用了……

平时,用nginx,也管着玩意……

然后,百度下,……说

把 httpd.conf.pre-update  替换为 httpd.conf

尼玛,误人啊……

然后谷歌下……

截图号大,……最后看算了……

虽然自己配置成功了……

但是,还是这个人写的好,所以我部再写了……

遇到 Forbidden 403, You don’t have permission to access /~username/ on this server


还是,不能访问,按照下面的教程,肯定成功!

地址:https://donatstudios.com/PHP-in-OS-X-Yosemite?#Comment209539


These instructions have been tested in OS X 10.10 Yosemite and OS X 10.11 El Capitan

The Setup

For the following examples, {username} represents your username.

Firstly, if you don't already have a Sites folder, create one in your home directory.

mkdir ~/Sites

Create or update /etc/apache2/users/{username}.conf to look as follows:

    Options Indexes MultiViews FollowSymLinks
    Require all granted
    AllowOverride All
    Order allow,deny
    Allow from all

Add your virtual hosts if you don't already have them to /etc/apache2/extra/httpd-vhosts.conf

ala:

  ServerName localhost
  DocumentRoot /Users/{username}/Sites/

Configuration

/etc/apache2/httpd.conf

Search for and uncomment the following lines:

LoadModule deflate_module libexec/apache2/mod_deflate.so
LoadModule userdir_module libexec/apache2/mod_userdir.so
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
LoadModule php5_module libexec/apache2/libphp5.so

Include /private/etc/apache2/extra/httpd-userdir.conf
Include /private/etc/apache2/extra/httpd-vhosts.conf

Then around line 271 add index.php to the DirectoryIndex

    DirectoryIndex index.html index.php

/etc/apache2/extra/httpd-userdir.conf

Uncomment the following line:

Include /private/etc/apache2/users/*.conf

Almost Done

Restart apache with sudo apachectl restart, open a browser and test it out.





上一篇:First page
下一篇:Last page