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

MAC OSX10.9.2上搭建Apache,php,osx10.9.2apache

程序员文章站 2024-01-08 14:31:58
...

MAC OSX10.9.2上搭建Apache,php,osx10.9.2apache

mac osx10.9.* 自带了apache, php

Apache配置

1- 启动

sudo apachectl start

启动后,访问 http://localhost/ 应该能看到"It works!"的初始页面,

vi /etc/apache2/httpd.conf

197行可以看到如下代码片段:


    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks MultiViews

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all

cd /Library/WebServer/Documents

It Works 内容在 index.html.en 这是apache的默认页

2- 停止/重启

sudo apachectl stop

sudo apachectl restart

3- 创建个人站点目录

cd ~

mkdir Sites

echo "helloWorld" >> index.html

sudo apachectl restart

然后再访问 http://localhost/~shelley/ 应该就能看到"helloWorld"的个人目录初始页面(注:~shelley需换成~你的用户名

如果失败

sudo vi /etc/apache2/users/Guest.conf

/Users/shelley/Sites