[软件安装] Apache & Httpd 安装教程

前言

前段时间重新安装了一下Apache. 在此记录一下过程。


简略

现在Apache服务器改名为httpd.
在这里插入图片描述

下载地址:
http://httpd.apache.org/modules/

在这里插入图片描述

我们这次因为需要在Windows服务器上进行部署。所以选择Winodws版本.

点进去可以看到,这里官方给出了几个子地址:
在这里插入图片描述

在这里插入图片描述
win32版本和win64版本。VS16表示是使用VS2016进行编译的。


安装

解压压缩包。可以看到一个
在这里插入图片描述

  • README.md 文件打开可以看到
5 August 2020
2 October 2020 Update, see changelog
                                                   Apache Lounge Distribution

                                                    Apache 2.4.46 win64 VS16

Announcement & Changelog: https://www.apachelounge.com/viewtopic.php?p=38419
License Information: https://www.apachelounge.com/contact.html

Home: www.apachelounge.com

Build with Visual Studio?2019 (VS16) x64


Minimum system required
-----------------------
### 安装的服务器基础环境
Windows 7 SP1
Windows 8 / 8.1
Windows 10
Windows Server 2019
Windows Server 2016
Windows Server 2008 R2 SP1 
Windows Server 2012 / R2
Windows Vista SP2

Install
-------
   
   ### 安装
  You must first install the Visual C++ Redistributable for Visual Studio 2015-2019 x64. 
  Download and Install, if you have not done so already, see:

   https://www.apachelounge.com/download/

  Unzip the Apache24 folder to c:/Apache24 (that is the ServerRoot in the config).
  The default folder for your your webpages is DocumentRoot "c:/Apache24/htdocs"

  When you unzip to an other location: 
  change Define SRVROOT "c:/Apache24"  in httpd.conf, for example to "E:/Apache24"

Run and test
------------

### 启动
  Open a command prompt window and cd to the c:\Apache24\bin folder.
  
  To Start Apache in the command prompt type:
  
    >httpd.exe
  
  Press Enter. If there are any errors it will tell you. 
  Warnings will not stop Apache from working, they do need to be addressed none the less. 
  If there are no errors the cursor will sit and blink on the next line. 
  
  You can test your installation by opening up your Browser and typing in the address:
  
  ### 访问localhost
     http://localhost
  
  You can shut down Apache by pressing Ctrl+C (It may take a few seconds)
  
  To install as a service. Open command prompt as Administrator and type:
  
    >httpd.exe -k install

  You can start/stop the service with the command:

  >services.msc
  
  
  To see all Command line options:
  
    >httpd -h

  
  ApacheMonitor:
  
  Double click ApacheMonitor.exe, or put it in your Startup folder.
  



Upgrading
---------

- Upgrading from 2.2.x see: httpd.apache.org/docs/2.4/upgrading.html
  and see httpd.apache.org/docs/2.4/new_features_2_4.html .

- Updating from 2.3.x
  copy all the files over, except your changed .conf files.



When you have questions or want more info, post in the forum at www.apachelounge.com or mail me.

Enjoy,

Steffen

简答总结:

  • 1.解压安装包,将c:/Apache24放到C盘根目录.

  • 2.使用httpd.exe进行运行.

  • 3.访问loclhost地址.

  • 正确响应(这边我改了端口。所以是8090)在这里插入图片描述

历史版本

http://archive.apache.org/dist/httpd/binaries/win32/
http://archive.apache.org/dist/httpd/


Q&A

Q1:
PS C:\Users\Administrator\Desktop\httpd\httpd-2.4.46-win64-VS16\Apache24\bin> .\httpd.exe
httpd.exe: Syntax error on line 39 of C:/Users/Administrator/Desktop/httpd/httpd-2.4.46-win64-VS16/Apache24/conf/httpd.conf: ServerRoot must be a valid directory
在这里插入图片描述
A: 这个问题一般是conf/httpd.conf的根目录文件夹配置错误导致的。默认地址一般是D:\apache\Apache24.改成你的安装地址即可.
在这里插入图片描述
Apache报ServerRoot must be a valid directory

Q2: 想要放到网页的文件应该放在什么地方?应该如何修改网页显示?
httdocs目录.
在这里插入图片描述
网页显示:在这里插入图片描述


Reference

[1]. windows下httpd的安装总结
[2]. Apache服务器的下载与安装
[3]. Windows 下Apache服务器搭建
[4]. Apache Windows下Apache安装步骤


©️2020 CSDN 皮肤主题: Age of Ai 设计师:meimeiellie 返回首页