安装前操作
1.上传安装包和依赖包
2.赋予文件可执行权限
3.解压缩安装包和依赖包
安装apache依赖包——apr
切换到解压后的apr目录下
./configure --prefix=/usr/local/apr/
make
make install
安装apache依赖包——apr-util
./configure --prefix=/usr/local/apr-util/ --with-apr=/usr/local/apr/bin/apr-1-config
make
make install
——make报错 [xml/apr_xml.lo] Error 1
yum -y install expat-devel
安装apache依赖包——pcre
./configure --prefix=/usr/local/pcre/
make
make install
——configure报错: error: You need a C++ compiler for C++ support.
yum -y install gcc-c++
安装httpd
——把前两个依赖包的源文件放入httpd安装包源文件 (注意路径已修改为海淀项目)
cp -rf /datas/apache_depends/apr-1.6.2 /datas/apache/httpd-2.4.28/srclib/apr
cp -rf /datas/apache_depends/apr-util-1.6.0 /datas/apache/httpd-2.4.28/srclib/apr-util
./configure --prefix=/usr/local/apache2 --with-included-apr --with-pcre=/usr/local/pcre/
make
make install
安装完后启动apache
./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
vi /usr/local/apache2/conf/httpd.conf
#ServerName www.example.com:80
改为ServerName localhost:80
二、配置apache
vi /usr/local/apache2/conf/httpd.conf
***************************************************************************
DocumentRoot "/usr/local/apache2/htdocs"
***************************************************************************
——修改html文件存放目录路径,配置用默认的。
***************************************************************************
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
***************************************************************************
——修改配置文件httpd.conf,引入虚拟主机配置,去掉Include前面的#
vi /usr/local/apache2/conf/extra/httpd-vhosts.conf
***************************************************************************
ServerAdmin webmaster@moa.gov.cn
DocumentRoot "/web/junbo"
ServerName localhost
ErrorLog "|/usr/local/apache2/bin/rotatelogs -l /weblogs/error_log 86400"
CustomLog "|/usr/local/apache2/bin/rotatelogs -l /weblogs/junbo_access_%Y%m%d.log 86400" combinedproxy
***************************************************************************