Mac Lion Configure Apache

mkdir ~/Sites

echo "<html><body><h1>My site works</h1></body></html>" > ~/Sites/index.html.en

sudo vi /etc/apache2/httpd.conf

#LoadModule php5_module libexec/apache2/libphp5.so

to

LoadModule php5_module libexec/apache2/libphp5.so

在/etc/apache2/下应该有一个用户配置文件,如果你是升级到Lion的你不会有,如果不存在的话就建立一个

sudo vi /etc/apache2/users/<your short user name>.conf

 输入

<Directory "/Users/<your short user name>/Sites/">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

 Lion的配置中已经没有了Sharing,你需要

sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist

 http://<your local host>/

“It works!"

http://<your local host>/~<your short user name>

"My Site Works".

echo "<?php echo phpinfo(); ?>" > ~/Sites/info.php

http://<your local host>/~<your short user name>/info.php

参考

posted on 2013-10-15 16:18  小浪鼓  阅读(376)  评论(0编辑  收藏  举报

导航