Apache2.4 server installation

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:

[html]  view plain copy  
  1. Define SRVROOT "/Apache24"    
  2. ServerRoot "${SRVROOT}"  

Change to the directory where you installed Apache:

[html]  view plain copy  
  1. Define SRVROOT "E:\Apache_App_Server\httpd-2.4.25-x64-vc14-r1\Apache24"  
  2. ServerRoot "${SRVROOT}"  
If you don't modify it, you will get an error:

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:

[html]  view plain copy  
  1. #Listen 12.34.56.78:80    
  2. Listen 80   
Change it to 8081 (you can define it yourself, but don't conflict with others)

[html]  view plain copy  
  1. #Listen 12.34.56.78:80  
  2. Listen 8081  
Amendment three:

Line 223 defaults to:

[html]  view plain copy  
  1. ServerName localhost:80   
Change it to:

[html]  view plain copy  
  1. 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


3、进入到bin目录下,然后按住shift按键不放单击鼠标的右键,选择 “在此处打开命令窗口”,并输入httpd.exe -k install,回车后可能会出现:w indows安装Apache,注册服务出现“(OS 5)拒绝访问。 : AH00369: Failed to open the WinNT service manager..."错误的信息,这时,只要在C:\Windows\SysWOW64目录下找到CMD.EXE文件,在这个文件上右键以管理员身份运行即可。最后通过命令进行到Apache的安装目录下再次httpd.exe -k install 安装apache服务,看到以下信息就说明 成功了。如下图


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):

[html]  view plain copy  
  1. sc delete apache  
apache is the service name of the Apache server 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324409307&siteId=291194637