1、apache依赖
apr apr-util pcre(perl库)
apr
./configure --prefix=/opt/soft/apr
make
make install
apr-util
./configure --prefi=/opt/soft/apr-util --with-apr=/opt/soft/apr/bin/apr-1-config
make
make install
cp apr apr-util 到 /opt/mj/apache/srclib (apr 、 apr-util 名字不能变,不能有版本号,否则报错:/mod_dir.so: undefined symbol: apr_array_clear)
pcre
./configure 报错:configure: error: You need a C++ compiler for C++ support
c++
yum install -y gcc gcc-c++(c++ 2015)
2、安装apache
2、安装apache
1)下载apache.tar.gz文件./configure --prefix=/opt/soft/apache --with-included-apr --with-pcre=/opt/mj/pcre-8.37/pcre-config --enable-so --enable-mods-shared=most --with-mpm=worker(默认安装在/usr/sbin/,配置项中不能有空格)makemake install
2)采用rpm安装:默认安装路径/etc/httpd启动目录/usr/sbin httpd apachectl
3、配置文件
/opt/soft/apache/conf/httpd.conf 修改ServerName www.bugs.com:8000 / Listen 8000
4、启动
/opt/soft/apache/bin/apachectl -k start (-t 查看状态 -v 查看版本)
service httpd start
httpd -v 查看版本号
httpd -t 查看状态
which httpd
(apache和httpd是一个,到apache2后就叫httpd)
查看apache进程 ps -ef | grep httpd
查看apache进程 ps -ef | grep httpd
5、验证:http://ip:port -》 It works!
6、错误解决
启动时报错:AH00557: httpd: apr_sockaddr_info_get() failed for wxwztestserver/
在配置文件中没有设置serviername,会用主机名代替
缺少VCRUNTIME140.dll
下载VCRUNTIME.dll到本机
Windows XP/WIN7/Vista系统,复制到C:\Windows\System32目录下。
如果您的系统是64位的请将文件复制到C:\Windows\SysWOW64目录
7、windows上安装
下载apache_2.2.4-win32-x86-no_ssl.msi文件
安装后net start apache2 其他跟liunx下配置相同
(bin目录下有ApacheMonitor.exe 管理服务UI 可以查看服务名称)
卸载 sc delete apache
8、apache中添加服务
http.conf中配置路径、配置解析模块等信息