Linux下Apache的安装

yum install -y gcc gcc-c++

 configure: error: APR not found . Please read the documentation

http://blog.chinaunix.net/uid-26729093-id-4315346.html


wget http://apache.fayea.com//httpd/httpd-2.4.10.tar.gz

执行命令 tar -zxvf httpd-2.4.10.tar.gz,解压缩后会生成httpd-2.4.10目录
cd httpd-2.4.10 进入httpd-2.4.10目录,搜寻设定内容,执行:
 

./configure --prefix=/usr/local/php --disable-fileinfo --enable-so  --enable-rewrite --enable-maintainer-zts --with-apxs2=/usr/local/apache/bin/apxs --with-iconv=/usr/local/libiconv --with-config-file-path=/usr/local/php/etc --enable-modules=shared --enable-mods-shared=all --with-pcre=/usr/local/pcre  --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util 

make

make install


(简单安装)
 
# 上面请特别注意到: 
 --prefix=/安装的路径:这个项目在设定未来你的 Apache 安装在那个目录当中?! 
--enable-so     :这个项目则是在宣告使用动态函式库啦!特别重要! 
--enable-rewrite  :这个项目只是预防用的!可以先设定,不过不一定会用到! 
 
 
 
################一下是yum install

命令很简单:

[root@sample ~]# yum -y install httpd  ← 在线安装httpd

然后就是配置一下文件

[root@sample ~]# getid /etc/httpd/conf/httpd.conf  ← 编辑Apache的配置文件

网站文件放在 /var/www/html/下

<Directory "/var/www/html">

hy

hy是网站的文件夹名,记得把权限全开

如果80端口被占的话,就改动

Listen 11.22.33.44:1300

然后:ServerName 11.22.33.44:1300

然后,启动HTTP服务

[root@sample ~]# chkconfig httpd on  ← 设置HTTP服务自启动

[root@sample ~]# chkconfig --list httpd httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off  ← 确认2--5为on的状态就OK

[root@sample ~]# /etc/init.d/httpd start  ← 启动HTTP服务 Starting httpd:              [ OK ] ← 启动成功会出现OK 如果启动失败的话,会出现错误信息。原因可能是因为httpd.conf文件编辑过程中的失误,请检查httpd.conf。

 
 
 
 
 
 
 
 
 
 
原文地址:https://www.cnblogs.com/hxl2009/p/3131745.html