Linux Apache安装与配置方法。,linuxapache


 

先解决依赖包。

apr  apr-util  pcre  

yum下载好提示版本低。(因为这里我使用的系统版本是6.5 ,7的系统直接yum安装完全可以)

这里使用的tar安装。

wget http://mirrors.shu.edu.cn/apache//apr/apr-1.6.3.tar.gz

 tar zxf apr-util-1.6.1.tar.gz          

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

make && make install

 

wget http://mirrors.shu.edu.cn/apache//apr/apr-util-1.6.1.tar.gz

 tar zxf apr-util-1.6.1.tar.gz 

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

 

make && make install

 

 wget https://sourceforge.net/projects/pcre/files/pcre/8.41/pcre-8.41.tar.gz/download '--no-check-certificate'

 ./configure --prefix=/usr/local/pcre 

make && make install

 

再去安装httpd。把apr apr-util 路径带上不然还会提示找不到。

./configure --prefix=/usr/local/httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre/ --enable-so --enable-rewrite --enable-charset-lite --enable-cgi

 

 

bin : http服务的各种执行程序文件

conf: http的各种配置文件

htdocs:存放网页的目录

logs:日志文件

modules: 各种模块

cgi-bin:各种cgi文件

 

 

ln -s /usr/local/httpd/bin/* /usr/local/bin/  弄个软连接方便使用。

添加http为系统服务。

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

vi /etc/init.d/httpd                           #先添加下面两条,不然 chkconfig --add httpd 会报错

# chkconfig: 35 61 61

# description: Apache

 

 chkconfig --add httpd

然后启动 这里报错了。不要慌张。

 

编辑 vim /usr/local/httpd/conf/httpd.conf 

下面这一行去把#去掉在重启一下就没问题了。

这里顺便改了一下域名。

 

 

echo "192.168.43.66 www.aaa.com" >> /etc/hosts

写域名解析

访问www.aaa.com

 

ok。

 

安装util时如果报错

xml/apr_xml.c: 在函数‘do_parse’中:xml/apr_xml.c:434: 错误:‘apr_xml_parser

yum -y install expat-devel  方可解决

 

遇到以下错误解决方法

make[2]: [htpasswd] 错误 1
make[2]: 离开目录“/usr/local/src/httpd-2.4.27/support”
make[1]: 
[all-recursive] 错误 1
make[1]: 离开目录“/usr/local/src/httpd-2.4.27/support”
make: *** [all-recursive] 错误 1
解决办法:
cd /usr/local/src/
cp -r apr-1.6.2  /usr/local/src/httpd-2.4.27/srclib/apr
cd apr-1.6.3
./configure --prefix=/usr/local/apr
make && make install
cp -r apr-util-1.6.0  /usr/local/src/httpd-2.4.27/srclib/apr-util
cd /usr/local/src/apr-util-1.5.4
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install

 

不行的话把pcre也这样弄一下。

 

 

 

 

 

相关内容

    暂无相关文章