Build an Apache server on Mac

Source: Internet
Author: User

Build an Apache server on Mac

Apache is one of the most popular Web server software. Its advantages and status are self-evident. The following describes how to build an Apache server on Mac:

(1) "go"-> "individual""

(2) create a folder in your personal directory and change it to "Sites" (after the change, a compass icon is displayed in the folder ). Note that it should be placed in the folder of the individual user, because it is your private folder like the folder such as the desktop, document, and so on. This folder is used for external network access.

(3) Open the terminal, switch to the directory of apache2, and enter ls to see an httpd. conf file. Next we will change the file.

(4) Back up a copy of the file to prevent subsequent steps from being broken. You can also use this copy. (When you enter the password, the terminal will not display any letters or the like. Just press enter after entering the password)

Input ls to view the copy http. conf. bak.

(5) enter the following command to edit the httpd. conf file and configure the server.

(If you see "Swap file". httpd. conf. swp "already exists !", Enter "E" and press enter to continue editing)

(6) Enter "/DocumentRoot" and press enter (/is a query command, indicating where the DocumentRoot is, and then you can modify it ).

(7) First press "I" to enter the editing mode; change the following two "/Library/WebServer/Documents" to the path of the Sites folder (note that "yons" Below is my user name, you should change it to your username. Or put a file in that Sites folder, and then copy its path, which is more secure than mistake ).

Changed to this:

(8) Next, find "Options" and "FollowSysLinks" under the modified location, and insert "Indexes" in the middle ". (This operation is not required if the mac is not upgraded to 10.10 ). After the change, press "esc" to exit the editing status. "-INSERT-" will disappear.

(9) Enter "/php" to search for php content:

(10) find this line and press the number '0' First, so that the cursor will move to the beginning of the line; then press the letter 'x', then the comment '#' in front of it will disappear.

(11) effect. Enter ": wq" to save the modification and exit. (If you think the modification has failed, you can enter ": q" to exit without saving the modification and then try again ).

(12) switch to the etc directory and copy Related Files

(13) Enter "ls" to see the two items in the current directory:

(14) enter the following command to restart Apache. (Ignore "AH00558 ....")

(15) Now we are done. You can enter "127.0.0.1" or "localhost" in your browser, or enter your IP address in your browser on another computer.

This article permanently updates the link address:

Related Article

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.