iOS Network Chapter 1-Simple Apache Server Setup

Source: Internet
Author: User
Tags exit in administrator password

Whether it is any mobile application, in order to maintain the vitality must be and the network data feedback, in order to facilitate the development, here is a simple implementation of the Mac on the local building for development testing server.

The main function of Web server is to provide online information browsing service, the server is a passive program, only when the client makes a request to respond,

The most common Web server is the Apache and Microsoft Internet Information Server IIS, in fact the Web server is a computer with a separate IP address on the Internet, and also refers to the program that manages the server.

First, build the goal:

1> Build Apache Server

2> supports PHP scripting language

Learn two common sense first:

IP Address: 127.0.0.1

is the loopback address, refers to the local machine, commonly used to test the use

No matter what program, once send data using loopback address, the protocol software returns immediately without any network transmission

Domain name: localhost

In the computer network, localhost (local host) is a standard host name for the Loop network interface, and the corresponding IP address is 127.0.0.1

Second, start the local Apache server:

In fact, the MAC has built the Apache server, we only need to make the relevant configuration to start the server is easy to manage, open the terminal, at the command line to edit.

1. Start

sudo apachectl-k start

Note: In Mac, if you want to execute a system-level command, you need to pass sudo, and you need to enter an administrator password to execute.

Test whether the server is started

Open Safari, enter localhost or 127.0.0.1 or native real IP address, if the return page shows it works instructions the server has been started.

Third, modify the Apache default document directory, convenient for us to manage

1. Enter the directory where the Apache configuration file is located

cd/etc/apache2/

2. Modifying the Apache configuration file

sudo vim httpd.conf

3. Enter this page after carriage return

4. Return search results after entering/documentroot

5. First note the original path and then add a new path (the new path builds itself, my path is built here:/users/wangchao/service)

6. Continue to find DocumentRoot string input/documentroot

7. Change this path to a previously established path

8. Enter: Wq Save exit

9. Return to the main window to restart the server

Note: Click I enter edit mode, press ESC to switch back to command mode, all modified directories are in edit mode, other search strings or save exit in command line mode.

10. By this time the Apache server configuration is complete, the new test.html is now under the/users/wangchao/service path to test whether Apache is working properly

Open Safari, enter http://localhost/text.html

Iv. Add PHP script support

1. Enter the directory where the Apache configuration file is located

cd/etc/apache2/

2. Modifying the Apache configuration file

sudo vim httpd.conf

3. Searching for strings

/php

Delete #, then press ESC, enter: Wq Save to exit

4. Go to the current directory

cd/etc/

5. Copy the Php.ini.default file as a php.ini

sudo cp php.ini.default php.ini

6. Restart the Apache server

sudo apachectl-k restart

7. Create a new info.php under the/users/wangchao/service path to test whether PHP supports

8. Open Safari, enter http://localhost/info.php

At this point, you can set up a database, build PHP scripting language, server testing.

iOS Network Chapter 1-Simple Apache Server Setup

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.