Configuring the Apache Server

Source: Internet
Author: User
Tags fully qualified domain name

Configure Apache server One, purpose
    • Can have a test server, not all of the special network services can be found free!
Second, why should we use "Apache"?
    1. Apache is currently the most widely used Web server
    2. Mac comes with, only need to modify a few configuration can be, simple, fast
    3. Some special server functions, Apache can be very good support (for example: HTTP put/delete operation, knowledge supplement involves the HTTPS service)
Iii. preparatory work
    • Set User password
Iv. Configuring the server
  1. Configuring the server's work
    • Create a "Sites" folder in the Finder and create it directly under the/users/apple (current user name) directory
    • Modify "Two Paths" in the configuration file to point to the folder you just created
    • Copy a file
  2. Configuring Server Considerations
    • Close Chinese Input Method
    • A "space" is required between the command and the argument
    • Modify system files Be sure to remember "sudo", otherwise there will be no permissions
    • Directory to be in/users/apple (current user name)
  3. Configure the server
    • Tips: OpenHeadof the,can beinCuffShellfish,butis aNoto beCuffShellfish
  4. Specific procedures

    • Switch working directory

      $cd /etc/apache2

    • backup Files , safekeeping, just need to be executed once.

      $sudo cp httpd.conf httpd.conf.bak

      Tip: If there is an error in subsequent actions! You can use the following command to recover a backed up httpd.conf file:

      $ sudo cp httpd.conf.bak httpd.conf

    • Edit httpd.conf with Vim

      $sudo vim httpd.conf

      Vim can only use the keyboard, can not use the mouse

    • Find DocumentRoot

      * /DocumentRoot
    • "Move cursor to First line" into edit mode

      * i
    • "Modify the path in quotation marks" (Enter command mode)

      * ESC
    • Find DocumentRoot

      * n
    • Enter edit mode

      * i
    • "Modify the path in parentheses"

      • Modify the path values in document and directory to:
        /Users/chenyong/Sites
      • Note: In Mac10.10, those two commands are in the same place, the Mac10.10 previous version in two places
    • Enter Command mode

      * ESC
    • Find PHP

      * /php
    • Delete Line Comment #

      * x
    • Save and exit

      * :wq
    • Do not save exit!!!!!!!!!

      * :q!
    • Switch working directory

      $cd /etc
    • Copy php.ini file

      $sudo cp php.ini.default php.ini
    • Restarting the Apache server

      $sudo apachectl -k restart

    Attention:

      • The following error is normal if prompted:

        Httpd:could not reliably determine the server ' s fully qualified domain name, using teacher.local for ServerName httpd not Running, trying to start
  5. Problems

    1. If you click the info.php file, the download appears, or you just display a small paragraph of text
      Workaround:
      * Enter the following two commands in the terminal: *

      • $sudo apachectl -k stopClose Apache Server
      • $sudo apachectl -k startRe-launch Apache again
    2. Every time you start your computer, the Apache server will not start automatically by default!

      After you can start the computer, open the terminal and enter the following command:

      $sudo apachectl -k startLaunch Apache

    3. The most common problem

      The swap file already exists, press the letter D directly, you can delete the swap file!

    4. The Apache configuration for Mac 10.10 is slightly different!

      See "Server Configuration Video \02-mac10.10 Apache configuration. mp4"

      Found in httpd.conf

      "Options FollowSymLinks Multiviews"

      Add a word Indexes, the result of the modification is as follows:

      "Options Indexes FollowSymLinks Multiviews"

      Tip: Don't take a minute to learn vim at the moment.

Configuring the Apache Server

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.