Linux上安装Apache与问题说明
下载Apache包,这里下载后和Windows不一样,需要编译和安装:
http://httpd.apache.org/ Apache Apache httpd 2.4.9 Released
下载:httpd-2.4.9.tar.gz
解压:
tar –zxvf httpd-2.4.9.tar.gz
进入:
cd tar –zxvf httpd-2.4.9
安装目录:
mkdir /usr/local/apache2
配置:
./configure --prefix=/usr/local/apache2 --enable-so -enable-proxy -enable-proxy_http=shared--enable-module=so --enable-mods-shared=all --enable-proxy-ajp=shared --enable-proxy-balancer -with-mpm=worker --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre
编译:
make
安装:
make install
启动与停止:
/usr/local/apache2/bin/apachectl start apaceh启动
/usr/local/apache2/bin/apachectl stop 停止
/usr/local/apache2/bin/apachectl restart 重启
如果遇到无法停止httpd服务的情况,使用命令:
killall -9 httpd
一般商用服务器都是由专门供应商来维护的,所以不用担心gcc的问题,但是如果你想测试却没有安装gcc,可以参考:
Rehat5 安装 GCC http://cuisuqiang.iteye.com/blog/1711153
如果你在安装中还遇到了configure: error: APR not found的错误,可以参考:
Apache安装问题:configure: error: APR not found . Please read the documentation http://cuisuqiang.iteye.com/blog/2068794
如果你没有安装FTP导致不能上传文件,可以参考:
Linux 下FTP搭建 http://cuisuqiang.iteye.com/blog/846521
或者安装SSH Secure来解决这个问题
如果遇到如下问题:
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 117.135.131.19. Set the 'ServerName' directive globally to suppress this message
这和conf/httpd.conf配置文件内的ServerName有关
# ServerName gives the name and port that the server uses to identify itself. # This can often be determined automatically, but we recommend you specify # it explicitly to prevent problems during startup. # # If your host doesn't have a registered DNS name, enter its IP address here. # #ServerName www.example.com:80
这里把ServerName放开,写ServerName localhost:80即可
如果在集群中传递的参数到后台是乱码,可以注意以下几点:
1:页面用的什么编码 JSP的 pageEncoding="UTF-8"
2:Tomcat用的什么编码 Connector中有定义编码的参数
3:集群中如果使用AJP了,AJP使用的什么编码 <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" useBodyEncodingForURI="true" URIEncoding="UTF8" />
4:Apache使用的什么编码 http://httpd.apache.org/docs/2.2/mod/mod_autoindex.html#indexoptions
如果你遇到了服务无法启动的情况,也不报错的,查看logs下的日志,首次安装报错如下:
AH01177: Failed to lookup provider 'shm' for 'slotmem': is mod_slotmem_shm loaded??
我想日志已经说的很清楚了,这里编译安装后,配置文件conf/httpd.conf没有开启mod_slotmem_shm模块,编辑该文件,放开
LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
访问http://IP:8008/ 输出It works!
请您到ITEYE网站看 java小强 原创,谢谢!
http://cuisuqiang.iteye.com/!
自建博客地址:http://www.javacui.com/ ,内容与ITEYE同步!
上一篇: 设计一套缓存框架需要关注的要素