How to install Apache and start the site under Windows

藏色散人
Release: 2022-04-08 16:31:14
forward
49377 people have browsed it

How to install Apache and start the site under Windows? The following article will introduce to you the steps to install Apache and start the site under Windows. It has certain reference value. Friends who need it can refer to it. I hope it will be helpful to everyone.

How to install Apache and start the site under Windows

1.apache official website to download the Apache HTTP Server server

I believe that some friends want to download the Apache HTTP Server from the official website when they first use the apache server Download it online, but facing the numerous projects, images and directories on the official website, you may be a little confused. The following are the specific steps:

①,Open the apache official website http://httpd.apache.org/ (or Baidu "download apache").

②、Click Download and the following interface will appear.

③、Select the Windows version to download and click the link.

##④、In the new interface, you will find the words VC9 and VC11. By reading the relevant content, you will know that VC9 refers to compiled with VS2008 The code, while VC11 is compiled with VS2012, and the code compiled with VS2012 cannot be used in Windows XP and Server 2003. For the sake of better compatibility, I chose to use VC9 to compile Apache. I chose to download it here and the download process is complete!

2.

Apache server installation

After the Apache server is downloaded, decompress it.

1. Download the installation package

2. Unzip the file to the directory you want to place it. Here I choose to put it in D:\Apache- 2.4.20 directory.

Note: The name of Apache24 can be changed according to your own situation. I changed it to "Apache" as follows:

3.

Apache server configuration

Open the httpd.conf file (for example, under D:\Apache-2.4.20\Apache\conf)

Modify the actual absolute installation directory of Apache:

Cannot have "/" or "\" at the end, because the directory configured later already has "/" or "\" at the beginning

, as shown in the figure below (where "${SRVROOT}"refers to the defined SRVROOT path variable):(can be "/", or Can be "\").

If your port 80 is occupied (you can use the command

netstat -an -o | findstr 80

under cmd), change port 80 to something else save.

Check whether the configuration file is legal:

httpd -t

Installation Apache's main service: With it, Apache can be started.

You can add the httpd.exe environment variable

, then open the cmd window and enter:httpd -k install -n Apache

This command means to install the Apache service that can be hosted by Windows. The parameter behind"-n"

is the custom Windows service name. You can then use the Windows management service command. To manage the apache service, such as"net start/stop apache"(start/stop service).The service is installed. After completion, it will be automatically tested. If there is a problem, the window will prompt an error. At this time, please troubleshoot according to the error.Normal installation is completed as shown in the figure below:

 Among them, Errors reported here must be corrected before the service can be started. It means "Errors reported here must be corrected before the service can be started."

4.Startup of the Apache server

After configuring the Apache server, we can start the server. There are three ways to start the Apache server under Windows.

1. Start using Windows

Open Computer Management and find the apache service item. After selecting it, right-click to select the corresponding operation (start, stop, restart)

2. Use the command line to start

httpd -k start: No detailed error message will be prompted.

httpd -k start -n apache: A detailed error message will be prompted. Change "apache" to your Apache service name, which can be found in the computer service.

httpd -k restart -n apachet:Restart.

net start apache: Use the Windows hosting service command.

3. Use the window of the Apache server itself to open

Find ApacheMonitor.exe in the bin directory, open

Double-click to run, desktop An icon will appear in the lower right corner. Double-click to open the window interface. You will see the following picture:

Click start on the left to start the apache service.

Supplementary sentence, it can be seen from this interface that it can manually control the opening and closing of the service. In order to save resources, when shutting down the Apache server, please click "Stop" to shut down the apache service. Of course, this service can also be turned off in Windows System Services (it is recommended to set it to manual).

The following picture shows the status of the service being successfully displayed:

Open the browser and enter http://localhost. If the following picture appears If the interface is displayed, the basic configuration of the Apache server is completed and the apache server is ready to run.

5.Uninstalling the Apache service

If you no longer want to use the Apache server software and want to uninstall it ,Be sure to uninstall the apache service first, and then delete the installation file(Remember, if you delete the folder in the installation path directly, there will be residual files on the computer, which may cause unnecessary trouble), in the cmd command window , enter as follows (it is recommended to stop the service first and then delete it):

httpd -k uninstallorsc delete apache(apache is the service name of the Apache server).

At this point, the downloading, installation, startup and uninstallation of the Apache server are all completed.

Note: Regarding the purpose of each file under the Apache server, as shown below:

More Apache related knowledge, Please visit theApache usage tutorialcolumn!

The above is the detailed content of How to install Apache and start the site under Windows. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!