Configure Apache under Mac

Source: Internet
Author: User

First, preface

Encounter problems today, how to configure Apache on the Mac, the original Mac with Apache, just need to open their own configuration on the line.

Second, step:

1. Modify Apache http_conf files

Open the Finder to/private/etc/apache2, and in this file there is a http.conf open with a text editor.

Change the first place : Find PHP. Get the following results

    #LoadModule Php5_module libexec/apache2/libphp5.so

  

Remove the previous # number.

Modify second place : Find DocumentRoot. Will find a similar statement

# # Documentroot:the directory out of which you'll serve your# documents. By default, all requests is taken from the This directory, but# symbolic links and aliases is used to point to other Loca tions. #DocumentRoot "/users/admin/sites" <directory "/users/admin/sites" >    #    # Possible values for the Options directive is "None", "All",    # or any combination of:    #   Indexes includes followsymlinks Symlinksifown Ermatch execcgi multiviews    #    Note that "MultiViews" must being named *explicitly*---"Options all"    # doesn ' t g Ive it to you.    #    # The Options directive is both complicated and important.  Please see    # http://httpd.apache.org/docs/2.4/mod/core.html#options    # for more information.    #    Options followsymlinks multiviews    multiviewsmatch any

  

Enter your own path in the DocumentRoot "" quotation mark. Mine is in the Users/admin/sites, and at the same time, the next to the directory of "" After the quotation marks also changed to their own path.

Modify the third place : find: Directory. Similar statements will be found

# # "/library/webserver/cgi-executables" should be changed to whatever your scriptaliased# CGI directory exists, if you hav E that configured.#<directory "/library/webserver/cgi-executables" >    allowoverride none    Options None    Require all granted</directory> <ifmodule mime_module>    #    # typesconfig points to the file Containing the list of mappings from    

  

Change the contents of <Directory></Directory> to me.

and then save.

Step Two: Restart Apache

Here are the commands you use.

  Stop service: Sudo/usr/sbin/apachectl stop              start service: Sudo/usr/sbin/apachectl Start              Restart Service: sudo/usr/sbin/apachectl restart

  

Then, you just create a new PHP file test in the folder you specified. (My in /users/admin/sites)

Configure Apache under Mac

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.