CentOS下怎么部署Apache服务(apache,centos,开发技术)

时间:2024-05-05 22:55:43 作者 : 石家庄SEO 分类 : 开发技术
  • TAG :
CentOS下怎么部署Apache服务

编译安装开发环境

编译安装前首先yum 安装“开发环境”“兼容库”“中文支持”即执行如下命令

#yumgroupinstall"Developmenttools""Compatibilitylibraries""ChineseSupport[zh]"-y

安装man, vim, wget 工具

#yuminstallmanvimwget-y

编译安装httpd

因为这次要编译安装httpd2.4.25,此版本需要更高版本的apr和apr-util。

因此要首先编译安装apr和apr-util。

wgethttp://mirrors.hust.edu.cn/apache/apr/apr-1.5.2.tar.bz2wgethttp://mirrors.hust.edu.cn/apache/apr/apr-util-1.5.4.tar.bz2

编译安装apr

tarxfapr-1.5.2.tar.bz2cdapr-1.5.2./configure--prefix=/usr/local/aprecho$?###如果执行结果是0,则继续执行make&&makeinstall

编译安装apr-util

tarxfapr-util-1.5.4.tar.bz2cdapr-util-1.5.4./configure--prefix=/usr/local/apr-util--with-apr=/usr/local/aprecho$?###如果执行结果是0,则继续执行make&&makeinstall

正式开始编译httpd-2.4.25

wgethttp://mirrors.hust.edu.cn/apache/httpd/httpd-2.4.25.tar.bz2

多次编译经验得知,缺少pcre相关文件,openssl is too old

执行如下命令:

yuminstallpcre-developensslopenssl-devel-ytarxfhttpd-2.4.25cdhttpd-2.4.25./configure--prefix=/usr/local/apache--sysconfdir=/etc/httpd--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util/

CentOS 6.5上编译安装Apache服务器的方法(最小化安装)

CentOS下怎么部署Apache服务 有如上提示则继续执行:make && make install

再执行echo$?如果结果是0,则说明httpd2.4.25到此编译成功,然后进行简单的配置,就可以使用了

配置httpd

关闭linux防火墙

servicehttpdstop

关闭SELinux

setenforce0

复制启动文件

cp/usr/local/apache/bin/apachectl/etc/init.d/httpd

把httpd的环境变量添加到“环境变量”

echo'exportPATH=$PATH:/usr/local/apache/bin'>/etc/profile.d/httpd.shchmod+x/etc/profile.d/httpd.shsource/etc/profile.d/httpd.sh

编辑httpd的配置文件:

vim/etc/httpd/httpd.conf

在ServerRoot下一行,添加 ServerName localhost

如果想把Apache服务加入到开机启动,可以修改服务启动脚本:

vim/etc/init.d/httpd

在第二行下添加:

#chkconfig:2358515#description:Thisisapacheserver

保存退出

执行命令

servicehttpdstart

#提示lynx找不到???那就

yuminstalllynx-y

执行命令

netstat-ntlp

#查看httpd是否启动,是否有80端口 最后在你的浏览器输入虚拟机IP地址

It works!

则Apache,安装成功

1、编译安装–默认的index.html首页在

/usr/local/apache/htdocs

2、配置文件:

/etc/httpd/httpd.conf

3、启动脚本:

/etc/init.d/httpd

4、cgi-bin文件目录:

/etc/local/apache/cgi-bin
 </div> <div class="zixun-tj-product adv-bottom"></div> </div> </div> <div class="prve-next-news">
本文:CentOS下怎么部署Apache服务的详细内容,希望对您有所帮助,信息来源于网络。
上一篇:CentOS7怎么安装WordPress下一篇:

15 人围观 / 0 条评论 ↓快速评论↓

(必须)

(必须,保密)

阿狸1 阿狸2 阿狸3 阿狸4 阿狸5 阿狸6 阿狸7 阿狸8 阿狸9 阿狸10 阿狸11 阿狸12 阿狸13 阿狸14 阿狸15 阿狸16 阿狸17 阿狸18