apache安装

来源:互联网 发布:网络市场推广方案 编辑:程序博客网 时间:2024/05/29 13:27


 

1.下载安装包:

       httpd              http://httpd.apache.org/

2.下载依赖包:

       apr        http://apr.apache.org/

       apr-util  http://apr.apache.org/

       pcre             http://www.pcre.org/

3.解压安装:先安装依赖包

       apr:

              拷贝文件到任意目录下

              gzip-d xxx.gz

              tar-xvf xxx.tar

              cdxxx

              ./configure

              make

              make install

              安装完成以后会在/usr/local下有apr目录

       apr-util:

              (前同apr)

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

               安装完成以后会把文件拷贝到usr/local/apt/lib/中

       pcre:

              unzip-d xxx.zip

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

              make

              make install

             

              这里依赖c++运行库,安装的时候发现缺少可以用apt-get install g++,apt-get install gcc, 在configure阶段如果缺少包会被提示

             

4.解压安装apache

       同apr,任意一个路径解压了,然后安装

       安装以后默认目录在/usr/local/apache2/

5.配置apache

       在apache2/conf/httpd.conf可以配置apache的参数

6.启动

       如果机器没有注册域名, 请把配置文件中的#ServerName localhost:80这解开注释

 

       apache2/bin/apachectl-k start

       还有别的指令可以直接apachectl -k获得帮助

      或者使用这个命令重启service httpd restart

       (在启动的时候可能会遇到找不到share lib的情况,运行ldconfig这个命令更新一下动态链接库即可,其配置文件在:/etc/ld.so.conf)

 

       

原创粉丝点击