Apache安装
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Apache安装,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3976字,纯文字阅读大概需要6分钟。
内容图文
Apache安装
1).查看一下当前 Linux系统的版本和内核
[root@web001 ~]# cat /etc/redhat-release CentOS release 6.4 (Final) [root@web001 ~]# uname -r 2.6.32-358.el6.x86_64 [root@web001 ~]#
2).查看本机是否安装 httpd 这个软件 也就是 Apache服务
[root@web001 ~]# rpm -qa httpd //结果是没有安装 [root@web001 ~]#
3).下载 httpd软件 (到官网下载 www.apache.org)
软件地址: http://mirrors.hust.edu.cn/apache/httpd/httpd-2.2.31.tar.gz
[root@web001 tools]# pwd /root/tools [root@web001 tools]# wget http://mirrors.hust.edu.cn/apache/httpd/httpd-2.2.31.tar.gz --2016-05-06 15:33:54-- http://mirrors.hust.edu.cn/apache/httpd/httpd-2.2.31.tar.gz Resolving mirrors.hust.edu.cn... 202.114.18.160
4).解压软件
[root@web001 tools]# [root@web001 tools]# ll total 7408 -rw-r--r--. 1 root root 7583841 Jul 17 2015 httpd-2.2.31.tar.gz [root@web001 tools]# [root@web001 tools]# tar xf httpd-2.2.31.tar.gz [root@web001 tools]# [root@web001 tools]# ll total 7412 drwxr-xr-x. 11 1000 1000 4096 Jul 16 2015 httpd-2.2.31 -rw-r--r--. 1 root root 7583841 Jul 17 2015 httpd-2.2.31.tar.gz
5).进入 httpd-2.2.31 进行 configure检查配置
./configure \
--prefix=/application/apache2.2.27 \
--enable-deflate \
--enable-expires \
--enable-headers \
--enable-modules=most \
--enable-so \
--enable-rewrite \
--with-mpm=worker
[root@web001 httpd-2.2.31]# pwd /root/tools/httpd-2.2.31 [root@web001 httpd-2.2.31]# ./configure > --prefix=/application/apache2.2.27 > --enable-deflate > --enable-expires > --enable-headers > --enable-modules=most > --enable-so > --enable-rewrite > --with-mpm=worker
以上参数讲解一下
./configure \
--prefix=/application/apache2.2.27 \ //Apache服务安装路径在哪里
--enable-deflate \ //服务器响应客户端,数据全部进行压缩,省带宽
--enable-expires \ //缓存过期 客户端请求服务器之后,数据缓存多久
--enable-headers \ //返回响应http响应头信息
--enable-modules=most \ //激活大多数模块功能
--enable-so \
--enable-rewrite \ //激活url重写模块 伪静态
--with-mpm=worker //进程的方式
以上检查可能会遇到问题
# checking for zlib location... not found 提示 zlib软件没有安装
解决方案:安装它们就可以了
[root@web001 httpd-2.2.31]# yum install zlib zlib-devel -y
再检查一下:运行上面的命令就可以了 不用重新配置 这里只是做上面一样工作
希望网友们不要误解 这里没有多一步,只是重新检查配置一下 因为第一次检查有软件没有安装到
[root@web001 httpd-2.2.31]# pwd /root/tools/httpd-2.2.31 [root@web001 httpd-2.2.31]# ./configure > --prefix=/application/apache2.2.27 > --enable-deflate > --enable-expires > --enable-headers > --enable-modules=most > --enable-so > --enable-rewrite > --with-mpm=worker
6).开始编译源代码 (这里时间有点长)
[root@web001 httpd-2.2.31]# make
7).开始安装软件
[root@web001 httpd-2.2.31]# make install
8).创建一个软链接
[root@web001 ~]# cd /application/apache2.2.27/ [root@web001 apache2.2.27]# ln -s /application/apache2.2.27/ /application/apache
9).检查语法,并开启apache服务
[root@web001 ~]# /application/apache2.2.27/bin/apachectl -t httpd: Could not reliably determine the server‘s fully qualified domain name.... Syntax OK [root@web001 ~]# /application/apache2.2.27/bin/apachectl start httpd: Could not reliably determine the server‘s fully qualified domain name.... [root@web001 ~]# //说明 出现上面的错误 我们不要去理会它....没什么大不了的
10).查看80端口是否成功开启
[root@web001 ~]# lsof -i:80 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME httpd 5842 root 4u IPv6 70975 0t0 TCP *:http (LISTEN) httpd 5844 daemon 4u IPv6 70975 0t0 TCP *:http (LISTEN) httpd 5845 daemon 4u IPv6 70975 0t0 TCP *:http (LISTEN) httpd 5846 daemon 4u IPv6 70975 0t0 TCP *:http (LISTEN)
11).关闭防火墙 关闭 SELinux
[root@web001 ~]# /etc/init.d/iptables stop [root@web001 ~]# setenforce 0 [root@web001 ~]# [root@web001 ~]# /etc/init.d/iptables status iptables: Firewall is not running. //防火墙关闭 [root@web001 ~]# getenforce Permissive //SELinux进入警告模式 [root@web001 ~]#
12).万事俱备,只欠访问......
[root@web001 ~]# curl -I 127.0.0.1 HTTP/1.1 200 OK Date: Fri, 06 May 2016 08:18:42 GMT Server: Apache/2.2.31 (Unix) DAV/2 Last-Modified: Sat, 20 Nov 2004 20:16:24 GMT ETag: "1ff10-2c-3e9564c23b600" Accept-Ranges: bytes Content-Length: 44 Content-Type: text/html
原文:http://771541213.blog.51cto.com/10810853/1773329
内容总结
以上是互联网集市为您收集整理的Apache安装全部内容,希望文章能够帮你解决Apache安装所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。