Linux二进制安装apache2.4.25
Linux二进制安装apache2.4.25
安装环境:CentOS 6.2
先检查是否安装了Apache
如通是通过rpm包安装的话直接用下面的命令:rpm -q httpd
也可以使用如下两种方法:
httpd -v
apachectl -v
如果已安装了Apache,则会显示
一。准备环境
1.安装gcc
[root@localhost /]# yum install gcc gcc-c++
2.安装apr,apr-util
下载apr-1.4.6.tar.gz与apr-util-1.5.1.tar.gz,地址:http://apr.apache.org ,上传至/usr/local,安装目录分别为/usr/local/apr 与/usr/local/apr-util
a.安装apr-1.4.6.tar.gz
[root@localhost local]# mkdir -p apr
[root@localhost local]# tar -zxf apr-1.4.6.tar.gz
[root@localhost local]# cd apr-1.4.6
[root@yahoo apr-1.4.6]# ./configure --prefix=/usr/local/apr
[root@yahoo apr-1.4.6]# make
[root@yahoo apr-1.4.6]# make install
b.安装apr-util-1.5.1.tar.gz
[root@localhost local]# mkdir -p apr-util
[root@localhost local]# tar -zxf apr-util-1.5.1.tar.gz
[root@localhost local]# cd apr-util-1.5.1
[root@yahoo apr-util-1.5.1]# ./configure --prefix=/usr/local/apr-util -with-apr=/usr/local/apr/bin/apr-1-config
[root@yahoo apr-util-1.5.1]# make
[root@yahoo apr-util-1.5.1]# make install
3.安装pcre-8.20.tar.gz
下载地址:http://sourceforge.net/projects/pcre/files/pcre/ ,上传至/usr/local,安装目录为/usr/local/pcre
[root@localhost local]# mkdir -p pcre
[root@localhost local]# tar -zxf pcre-8.20.tar.gz
[root@localhost local]# cd pcre-8.20
[root@yahoo pcre-8.20]# ./configure --prefix=/usr/local/pcre
[root@yahoo pcre-8.20]# make
[root@yahoo pcre-8.20]# make install
二。安装apache
1.下载httpd-2.4.25.tar.gz,地址是:http://httpd.apache.org/ ,上传至/usr/local,安装目录为/usr/local/apache2
2.安装
[root@localhost local]# mkdir -p /usr/local/apache2
[root@localhost local]# tar zxvf httpd-2.4.25.tar.gz
[root@localhost local]# cd httpd-2.4.25
[root@localhost httpd-2.4.25]# ./configure --prefix=/usr/local/apache2 --with-pcre=/usr/local/pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
[root@localhost httpd-2.4.25]# make
[root@localhost httpd-2.4.25]# make install
[root@localhost httpd-2.4.25]# /usr/local/apache2/bin/apachectl start
用浏览器访问http://localhost,看到It works!,说明CentOS Apache安装成功了,恭喜您!
3.启动
第一种方法[root@localhost apache2]# /usr/local/apache2/bin/apachectl start 一定要是绝对路径
第二种方法[root@localhost apache2]#service httpd start
第二种方法[root@localhost apache2]#/etc/init.d/httpd start
三。安装出现的问题
1.configure: error: no acceptable cc found in $PATH
解决办法:yum install gcc gcc-c++
2.configure: error: APR not found. Please read the documentation.
解决方法:安装Apache的关联软件
如上安装apr-1.4.6.tar.gz
3.configure: error: APR-util not found. Please read the documentation
解决方法:安装apr-util
如上安装apr-util-1.5.1.tar.gz
4.configure: error: APR version 1.3.0 or later is required
主要是因为apr版本过低造成的,应该卸载相关旧版本
5. 启动时报错:
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
解救办法:绝对路径即可:/usr/local/apache2/bin/apachectl start
要想彻底不显示此行解决方法:
apache/conf/httpd.conf
首先找到ServerName(约213行),将其设置为localhost:80,并将前面的井号删除,虽然这一步如果不修改的话也可以正常运行,但启动Apache服务时会有一条烦人的提示(AH00558: httpd.exe: Could not reliably determine the server's fully qualified do main name, using fe80::fc76:abca:e24b:d490. Set the 'ServerName' directive globally to suppress this message)
6.安装完apache时,访问时Index of /,为什么不是it works
让别人知道你的网站目录结构直接查看你目录下的所有文件是很危险的一个事情。
下面介绍解决方法
apache/conf/httpd.conf
找到:
Options indexes FollowSymLinks
改为:
Options FollowSymLinks
当直接访问某个目录时显示下图就表明设置成功了。
7.重启apache时,报:DocumentRoot must be a directory
原因:apache/confi/httpd.conf里面有DocumentRoot配置文件,但实际目录中又没有这个目录,注释此配置即可。
8.[root@localhost conf]# /usr/local/apache2/bin/apachectl start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
解决方法:apache2/conf/httpd.conf Listener 80改为其它的端口号即可。
四。重要配置文件目录
/etc/httpd/conf/httpd.conf 最主要的配置文件
/usr/lib/httpd/modules:apache 支持很多的模块,所以你想要使用的模块默认都放置在此目录
/var/log/httpd apache默认的log
/var/www/html cenos默认的首页所在目录
五。配置apache,最后修改httpd.conf,使apache能使用php
增加如下参数
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
AddType image/x-icon .ico
DirectoryIndex index.php index.html index.html.var
Linux二进制安装apache2.4.25的更多相关文章
- CentOS6.3 编译安装LAMP(2):编译安装 Apache2.2.25
所需源码包: /usr/local/src/Apache-2.2.25/httpd-2.2.25.tar.gz 编译安装 Apache2.2.25 #切换到源码目录 cd /usr/local/src ...
- CentOS 6.2 二进制安装apache2.4.3出现configure: error: APR-util not found. Please read the documentation的解决方
CentOS 6.2 二进制安装apache2.4.3出现configure: error: APR-util not found. Please read the documentation的解决方 ...
- Linux 下安装apache2.4
Linux 下安装apache2.4 下载,解压,配置安装! 好生麻烦! 安装一个apache,需要很多依赖!比如apr.apr-util.pcre等等. 这些依赖有可能还需要别的更多的依赖! 真心的 ...
- Linux环境下源码安装Apache2.2.25
操作环境:RedHat Enterprise Linux 5.6 一.安装准备 安装Apache一般依赖3个组件:apr.apr-util.pcre. 确保这三个组件已经安装. [root@bigsr ...
- linux下安装apache2.4
linux安装Apache2步骤如下 apr 下载地址 http://mirrors.cnnic.cn/apache//apr/apr-1.5.2.tar.gz 安装过程 tar -xzvf apr- ...
- CentOS安装Apache-2.4.25+安全配置
注:以下所有操作均在CentOS 6.5 x86_64位系统下完成. #准备工作# 在安装Nginx之前,请确保已经使用yum安装了各基础组件,并且配置了www用户和用户组,具体见<CentOS ...
- MySQL5.7 linux二进制安装
200 ? "200px" : this.width)!important;} --> 介绍 MySQL5.7出来也有大半年了,业内也一直在宣传5.7有多么的N,官网的也是宣 ...
- MySQL linux二进制安装
200 ? "200px" : this.width)!important;} --> 介绍 1.创建用户和目录 groupadd mysql useradd -r -g m ...
- linux下安装apache2.2.27
1.首先下载httpd-2.2.27.tar.gz用linux命令下载 wget http://mirrors.cnnic.cn/apache//httpd/httpd-2.2.27.tar.gz 2 ...
随机推荐
- 使用 JS 输出螺旋矩阵
关于螺旋矩阵 这是我曾经遇到过的面试题,在 LeetCode 上找到了题目的原型,难度中等.题目描述如下: 给定一个包含 m x n 个元素的矩阵(m 行, n 列),请按照顺时针螺旋顺序,返回矩阵中 ...
- Unity TimeLine 资源结构
---恢复内容开始--- 先看一个TimeLine,如图 再来看看在Inspector中的PlayableDirector 其他参数字面意思很清楚了不再赘述,着重讲一下一个TimeLine绑定的资源. ...
- .netcore 读取ansi编码
public class FileHelper { //根据文件自动觉察编码并输出内容 public static string GetText(string path) { StringBuilde ...
- squid3.5缓存代理实践记录
准备: 两台服务器,一台web,一台squid缓存代理 squid机域名:www.dannylinux.top web机IP:12.1.1.1 1.版本: [root@danny squid]# sq ...
- window.open() & iframe & tab
window.open() & iframe & tab window.open() open pages in the same window / tab https://stack ...
- Nginx访问配置
配置HTTP协议(使用80默认端口,非HTTPS配置SSL)访问网站 包括RestAPI的配置和RestAPI文档的配置 例如: server { # 配置为HTTP协议 listen ; serve ...
- 使用vue全家桶制作博客网站
前面的话 笔者在做一个完整的博客上线项目,包括前台.后台.后端接口和服务器配置.本文将详细介绍使用vue全家桶制作的博客网站 概述 该项目是基于vue全家桶(vue.vue-router.vuex.v ...
- magento 2 method config
1. 模板渲染静态文件: <?php echo $this->getViewFileUrl('requirejs::require.js'); ?> 2.
- package.json 中script脚本传入参数问题
"build:test": "cross-env BUILD_ENV=dev nuxt build", 最近项目中通过传入自定义参数区分测试和正式环境,但是发现 ...
- HFSS在进行仿真时端口与激励设置细则
最近发现在使用HFSS仿真天线时候在设置端口激励求解的时候,由于端口激励面积的大小和放置方式的不通最终的求解结果也有很多不同 在进行CPW结构的天线仿真中分别尝试了waveport 和lumpedpo ...