Installing Apache Web server under Windows

Source: Internet
Author: User

  Download of 1.Apache Server

Go to download page: http://httpd.apache.org/download.cgi

To increase the download speed, the image selects the server of Tsinghua University (http://mirrors.tuna.tsinghua.edu.cn/apache/), 1.1. Then click on the Files for Microsoft Windows link to go to the page shown in Figure 1.2.

Figure 1.1

Click Apachehans to go to the download page in Figure 1.3. This includes Apache compiled by someone else.

Figure 1.2

In the download page, you can choose to download the version according to the installation environment, I install the environment for Win32, so download Httpd-2.4.20-x86-vc14-r2.zip.

Figure 1.3

installation configuration for 2.Apache servers

After the download is complete, unzip to generate a folder (APACHE24) and a file (readme_first.html). The readme_first.html file contains detailed operational steps for the Apache service.

First step, go to the \apache24\bin folder and double-click Httpd.exe. The following error may occur, this is due to the installation of the VC compiler environment, to the Microsoft official website Download Vc_redist.2015.x64.exe Installation can resolve this issue.

Figure 2.1

The second step is to install the Apache2.4 service. Open cmd Command window, enter \apache24\bin, execute installation command: httpd-k install. After the command execution completes, the installation is successful, but the boot fails (Figure 2.2), the reason for the failure is: ServerRoot must be a valid directory. The root directory of Apache could not be found.

Figure 2.2

To resolve this issue, open the Apache server profile file \apache24\conf\httpd.conf, open it with Notepad, and locate Define srvroot "/apache24"  , comment out with # and add a line Define srvroot "C:\Program files\apache24" (2.3), that is, the ServerRoot path modified correctly, I Apache directory is C:\Program Files\apache24.

Figure 2.3

The third step is to start the Apache service. After modifying the completion profile to start the Apache2.4 service, the service can be started by running the command httpd-k start in the \apache24\bin directory or through the net start Apache2. 4 to start, the difference is that the former console does not have any prompts, while the latter in the console will prompt the success of the service, without knowing the service name, it is recommended to start through the former. After successful startup, you can view the service Apache2.4 in Task Manager, figure 2.4.

Figure 2.4

Note: the installation of 1.Apache services and the need for administrator privileges to start stop should run CMD as an administrator.

The 2.Apache service has a default port number of 80, and you can modify the port number by modifying the Listen property in the configuration file \apache24\conf\httpd.conf.

  3. Deploying Web Projects

When you deploy a Dynamic Web site project in Apache, the web framework differs and requires different configurations, and the general idea is to first modify the DocumentRoot property value in the configuration file to indicate the path to the Web project, for example: DocumentRoot "D:\myapp", Then modify the DirectoryIndex property to indicate the default document, for example: DirectoryIndex index.html index.php, which indicates that the default document is Index.html or index.php. If the installation is successful, enter http://localhost in the browser to display the contents of the page. I am using port 88, so I need to add a port number when I visit. Page content display success can be considered successful Apache installation, of course, in the deployment of different frameworks (such as PHP) developed Web projects need to be further configured, I display content is HTML static document content.

Figure 3.1

Installing Apache Web server under Windows

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.