1. Version introduction and installation process
First we have to download the Apache2.4 server: http://httpd.apache.org/.
Regarding the current version of the server, I want to explain here that Apache cannot use its own server, and it must be compiled before it can be used. But he also provides a third-party compiled Apache on his official website, so here we will download the third-party one instead of compiling it manually. Here it provides five third-party servers.
1. If you want to install the inherited development environment, you can choose the last two WampServer and XAMPP, which are very convenient to install and use.
2. To download a separate installation package, you can choose the first two websites ApacheHaus and Apache Lounge
Download the project as shown below:
Note: Today we will take ApacheHaus as an example . Other versions may have different configurations. You can search and solve by yourself. Download the server according to the provided URL
2. Apache server configuration
1. After downloading, we will decompress the compressed package, and then place the decompressed files in the specified directory (the following is your own placement directory):
After decompression, you can see the following directory structure:
2. Enter the conf directory to open the httpd.conf file and modify the default configuration:
Modification one:
Line 38 defaults to:
- Define SRVROOT "/Apache24"
- ServerRoot "${SRVROOT}"
Change to the directory where you installed Apache:
- Define SRVROOT "E:\Apache_App_Server\httpd-2.4.25-x64-vc14-r1\Apache24"
- ServerRoot "${SRVROOT}"
httpd.exe: Syntax error on line 39 of D:/Android_Develop_Tools/httpd-2.4.23-x64-
vc14/Apache24/conf/httpd.conf: ServerRoot must be a valid directory
Amendment two:
Line 60 defaults to:
- #Listen 12.34.56.78:80
- Listen 80
- #Listen 12.34.56.78:80
- Listen 8081
Line 223 defaults to:
- ServerName localhost:80
- ServerName localhost:8081
If you don't modify it, you will get an error:
(OS 10048) Usually only one use of each socket address (protocol/network address/port) is allowed. : AH00072: make_sock: could not bind to address [::]:80
(OS 10048) Usually each socket address (protocol/network address/port) is only allowed once. : AH00072: make_sock: could not bind to address 0.0.0.0:80
AH00451: no listening sockets available, shutting down
4、解决443端口被占了
(OS 10048)通常每个套接字地址(协议/网络地址/端口)只允许使用一次。 : AH00072: make_sock: could not bind to address [::]:443
(OS 10048)通常每个套接字地址(协议/网络地址/端口)只允许使用一次。 : AH00072: make_sock: could not bind to address 0.0.0.0:443 AH00451: no listening sockets available, shutting down
如果提示你上方的信息说明你的443端口被占用了,解决办法为
打开httpd.conf, 找到加载ssl_module的那一行, 加#号注释掉就好了:# LoadModule ssl_module modules/mod_ssl.so
Now enter the httpd.exe -k start command and that’s it. ( httpd.exe -k start is the command to start the Apache service )
We enter http://localhost:8081/index.html in the browser, and the effect is shown in the following figure:
Special Note:
After Apache is installed successfully, in the installation directory, find E:\Apache_App_Server\httpd-2.4.25-x64-vc14-r1\Apache24\bin\ApacheMonitor.exe executable file, double-click to run, an icon will appear in the lower right corner of the desktop, double-click Open the window interface as shown below and click start to start the Apacha service.
Now it is in the startup state. Of course, you can also manually perform operations such as Shop, Start, and Exit.
At this point, the apache service is successfully installed.
Additional instructions:
If you no longer want to use the Apache server software and want to uninstall it, you need to uninstall the apache service first (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 the following (it is recommended to stop the service first and then delete it):
- sc delete apache