Apache软件安装与配置【图文教程】
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">Apache HTTP Sérver(简<span style="color: black;">叫作</span>Apache)是Apache 软件基金会发布的一款Web服务器软件,<span style="color: black;">因为</span>其<span style="color: black;">拥有</span>开源、跨平台和相对安全的特点而被广泛<span style="color: black;">运用</span>。Apache 2.4.38版本的软件安装与配置。</span></p>
<h1 style="color: black; text-align: left; margin-bottom: 10px;">1.准备工作</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">首要</span>在系统C盘根目录下创建一个名为web的文件夹,<span style="color: black;">做为</span>PHP<span style="color: black;">研发</span>环境的安装位置,并在web中创建apache2.4子文件夹,将Apache安装到此文件夹中进行管理。</span></p>
<h1 style="color: black; text-align: left; margin-bottom: 10px;">2.获取Apache</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">Apache在官方网站上<span style="color: black;">供给</span>了软件源代码可供下载,但<span style="color: black;">无</span><span style="color: black;">供给</span>编译后的软件。<span style="color: black;">能够</span>从其他网站中hy_ k4____.m ihn获1编译后的软件。在Apache网站中<span style="color: black;">能够</span>找到适用于Windows系统的第三方编译版本的链接。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">其中,Bitnami WAMP Stack、WampServer、XAMPP网站<span style="color: black;">供给</span>的是<span style="color: black;">包括</span>Apache、MySQL、PIHP等软件的集成包,<span style="color: black;">倘若</span>单独下载Apache,<span style="color: black;">能够</span><span style="color: black;">运用</span>ApacheHlas或Apache loumge网站<span style="color: black;">供给</span>的软件LA-pache Lounge</p>网站为例,该网站<span style="color: black;">供给</span>了VS16、VC15,VC14等编译版本的软件下载,如图所示。
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/8b624578afe54ea8967db7f2aae1e5a5~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728209376&x-signature=DRCzJw3OHKoJCdp1tCXf3s3t1h0%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">在网站中找到“</p>htpd-2.4.38-win32-VC15.zip”这个版本进行下载<span style="color: black;">就可</span>。
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">需要<span style="color: black;">重视</span>的是,VCI5<span style="color: black;">指的是</span>该软件<span style="color: black;">经过</span> Micmsoft Visual C++2017进行编译,<span style="color: black;">亦</span>就<span style="color: black;">暗示</span>运行该软件需要Mierosoft Visual C++2017运行库,在安装Apache前需要先在Windows系统中安装此运行库。ApacheLounge网站<span style="color: black;">供给</span>的下载页面中<span style="color: black;">已然</span>给出了运行库的下载链接,读者<span style="color: black;">亦</span><span style="color: black;">能够</span>从Micrsoft官方网站中获取下载链接。</span></p>
<h1 style="color: black; text-align: left; margin-bottom: 10px;">3.解压与配置</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">(1)将hitpd-2.45mwin32-VC15.zip 压缩包中的Apache24目录下的文件解压到CAwebapache2.4路径下,如图1-8所示。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">图为Apache的目录结构,其中bin是Apache应用程序所在的目录,conf是配置文件目录,htdoes是默认的网站根</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/01d5ec1f17e243fea0744b7d06e0fdd9~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728209376&x-signature=MFczlSm7NdyW8z86pjanqlTH2Lw%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">目录网页文档目录,modules是Apache支持的动态加载模块所在的目录。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">(2)修改Apache的配置文件,配置安装路径。配置文件<span style="color: black;">位置</span>是confhttpd.conf.<span style="color: black;">运用</span>VS Code编辑器打开它,找到第37行代码,<span style="color: black;">详细</span>代码如下。</span></p>Def<span style="color: black;">ine</span> SRVROOT <span style="color: black;">"o:/apache24"</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">以上</span>代码用来配置Apache的安装路径,将路径修改为“CAwsebapache2.4”<span style="color: black;">就可</span>。修改后的结果如下。</span></p><span style="color: black;">Define</span> SRVROOP <span style="color: black;">"C: \weblapache2.4"</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">(3)按“Crl+F”组合键,搜索“ServerName”,找到如下配置。</span></p>4<span style="color: black;">ServerNane</span> <span style="color: black;">ww</span><span style="color: black;">.exanple</span>,<span style="color: black;">con</span><span style="color: black;">:80</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">以上</span>代码<span style="color: black;">暗示</span>配置服务器域名,<span style="color: black;">倘若</span>不配置,在安装Apache时会<span style="color: black;">显现</span>警告。在代码的开头有个“#”.<span style="color: black;">暗示</span>该行是注释文本,应删去“”使其生效,代码如下所示。</span></p><span style="color: black;">ServerName</span> <span style="color: black;">wow</span><span style="color: black;">.exanple</span><span style="color: black;">.con</span><span style="color: black;">:80</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">为了使读者<span style="color: black;">熟练</span>Apache 配置文件hipd.conf的<span style="color: black;">运用</span>,下面<span style="color: black;">经过</span>表1-1对其常用的配置项进行解释。</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/515037af3d304aa99a97e5cbdd78f889~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728209376&x-signature=dQ16Nma%2BOpbyltRaReBfk1TPAYc%3D" style="width: 50%; margin-bottom: 20px;"></div>
<h1 style="color: black; text-align: left; margin-bottom: 10px;">4.<span style="color: black;">起始</span>安装</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">Apacbe需要<span style="color: black;">经过</span>命令行的方式来进行安装,<span style="color: black;">详细</span>操作<span style="color: black;">过程</span>如下。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">(1)“<span style="color: black;">起始</span>”菜单中<span style="color: black;">选取</span>“所有程序”→“附件”。找到“命令提示符”后,单击鼠标右键,<span style="color: black;">选取</span>“以管理员身份运行”。</span></p><span style="color: black;">cd</span> C: \web apacbe2.4\bin<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">(2)在cmd窗口中执行如下命令,将当前目录切换到Apache的bin目录。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">(3)输人以下命令<span style="color: black;">起始</span>安装。</span></p><span style="color: black;">httpd</span> <span style="color: black;">-k</span> <span style="color: black;">Instal1</span> <span style="color: black;">-n</span> <span style="color: black;">Apache2</span><span style="color: black;">.4</span>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">在<span style="color: black;">以上</span>命令中,“htpd”<span style="color: black;">暗示</span>Apache的服务程序htpd.exe;“-k install”<span style="color: black;">暗示</span>将Apache安装为Windows系统的服务项;“-n Apache2.4”<span style="color: black;">暗示</span>将Apache 服务的名<span style="color: black;">叫作</span>设置为Apache2.4。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">安装成功后的效果如图1-9所示。</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/a3ad16aea74c42c5ab8f04907bda2a6b~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728209376&x-signature=yLqBW0tRDAvR5WLNVlINh01X%2B30%3D" style="width: 50%; margin-bottom: 20px;">
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">经过</span>命令行安装Apache</p>
</div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;"><span style="color: black;">倘若</span>需要卸载Apache,<span style="color: black;">能够</span><span style="color: black;">运用</span>如下命令进行卸载。</span></p><span style="color: black;">httpd</span> <span style="color: black;">-k</span> <span style="color: black;">uninstall</span> <span style="color: black;">-n</span> <span style="color: black;">Apache2</span><span style="color: black;">.4</span>
<h1 style="color: black; text-align: left; margin-bottom: 10px;">5.<span style="color: black;">起步</span>Apache 服务</h1>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">安装Apache后.Apache就<span style="color: black;">能够</span><span style="color: black;">做为</span>Windows的服务项被<span style="color: black;">起步</span>或关闭了。Apache<span style="color: black;">供给</span>了服务<span style="color: black;">监测</span>工具Apache Service Monitor,用于管理Apache 服务.程序<span style="color: black;">位置于</span>bin 目录下的ApacheMonitorsexe。打开ApacheMonitor.exe,Windows系统任务栏右下角状态栏会<span style="color: black;">显现</span>Apache的小图标管理工具,单击该图标会弹出<span style="color: black;">掌控</span>菜单,如图所示。</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/fe1705498cbe4ea9bdbf968fbd92639c~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728209376&x-signature=5rhmBDAqxyGTkjlhg6ladN67W8I%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">从图中<span style="color: black;">能够</span>看出,<span style="color: black;">经过</span>Apache Service Monitor<span style="color: black;">能够</span>快捷地<span style="color: black;">掌控</span>Apoche 服务的<span style="color: black;">起步</span>、停止和重新<span style="color: black;">起步</span>。单击“Star”<span style="color: black;">能够</span><span style="color: black;">起步</span>服务,当图标由红色变为绿色时,<span style="color: black;">暗示</span><span style="color: black;">起步</span>成功。</span></p>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">将Apache 成功<span style="color: black;">起步</span>后,在浏览器<span style="color: black;">位置</span>栏输人“hitpe/localhost”后按“Enter”键,<span style="color: black;">倘若</span>看到图1-11所示的页面,说明Apache正常运行。</span></p>
<div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://p3-sign.toutiaoimg.com/tos-cn-i-qvj2lq49k0/9d449d04f55d420f91e3c53b5dfe7b4e~noop.image?_iz=58558&from=article.pc_detail&lk3s=953192f4&x-expires=1728209376&x-signature=mk9dsVHKZlqJWb2J8tjgdwJXMbg%3D" style="width: 50%; margin-bottom: 20px;"></div>
<p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">所示的“It works!”是Apache默认站点下的首页,即htdoesindlex.html这个网页的<span style="color: black;">表示</span>结果。读者<span style="color: black;">亦</span><span style="color: black;">能够</span>将其他网页放到hdos目录下,<span style="color: black;">而后</span><span style="color: black;">经过</span>“htp/Mocalhost/网页文件名”进行<span style="color: black;">拜访</span>。</span></p>
我完全同意你的观点,说得太对了。 软文发布论坛开幕式圆满成功。 http://www.fok120.com
页:
[1]