栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

Linux 安装 Apache 及配置运行

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Linux 安装 Apache 及配置运行

Linux 安装 Apache 及配置运行

文章目录

Linux 安装 Apache 及配置运行

0:前言1:安装apr2:安装expat-devel3:安装apr-util4:安装apache5:运行apache--------------------------------------------------------------notice 1:关于AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using . Set the 'ServerName' directive globally to suppress this message;及自定义端口notice 2:关于防火墙,无法访问notice 3:浏览器访问

0:前言

需要安装的软件比较多,比如apr,apr-util等安装完毕后才可以正确安装运行apache,此外apache依赖于apr-util,apr-util依赖于apr,而apr-util又依赖于expat-devel。

1:安装apr
wget https://dlcdn.apache.org//apr/apr-1.7.0.tar.gz

tar -xzvf apr-1.7.0.tar.gz

cd apr-1.7.0 

./configue --prefix=/usr/local/apr

make

make install

cd ..
2:安装expat-devel
yum install expat-devel
3:安装apr-util
wget https://dlcdn.apache.org//apr/apr-util-1.6.1.tar.gz

tar -xzvf apr-util-1.6.1.tar.gz

cd apr-util-1.6.1 

./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config

make

make install

cd ..
4:安装apache
wget https://dlcdn.apache.org//httpd/httpd-2.4.52.tar.gz

tar -xzvf httpd-2.4.52.tar.gz

cd httpd-2.4.52

./configure --prefix=/usr/local/apache --with-apr-util=/usr/local/apr-util

make

make install

cd ..
5:运行apache
/usr/local/apache/bin/apachectl start
-------------------------------------------------------------- notice 1:关于AH00558: httpd: Could not reliably determine the server’s fully qualified domain name, using . Set the ‘ServerName’ directive globally to suppress this message;及自定义端口

这一步是没有设置服务器的完全限定域名,比如 www.aaa.com 就是你的服务器域名,你需要在ServerName配置上。在不配置的情况下并不影响程序正常执行,如有需要可以去除该提醒。

执行:

vi /usr/local/apache/conf/httpd.conf


如图:将前面的 # 号去掉就行。另外 www.example.com 用于示例域名。可以在没有正式域名的情况下使用此域名。

此外,你也可以在此步修改自定义端口号:

修改端口号:Listen 5555(自定义域名)

notice 2:关于防火墙,无法访问

如果是购买的云服务器,注意开启服务器防火墙,不然无法访问。

notice 3:浏览器访问
1.11.111.11:5555(这里1.11.111.11是你的服务器域名,切记开启该端口的防火墙)


当浏览器出现 It works! 证明运行成功。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/705466.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号