Apache是时下最流行的Web服务器软件之一,支持
编译和安装 APR
$wget
$ tar -zxf apr-1.5.2.tar.gz
$ cd apr-1.5.2
$ ./configure –prefix=/usr/local/apr
$ make && make install
编译和安装 apr-util
$wget
$ tar -zxf apr-util-1.5.3.tar.gz
$ cd apr-util-1.5.3
$ ./configure –prefix=/usr/local/apr-util –with-apr=/usr/local/apr
$ make && make install
编译和安装 pcre
$wgetftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.gz
$tar -zxf pcre-8.37.tar.gz
$ cd pcre-8.37
$ ./configure –prefix=/usr/local/pcre
$ make && make install
重新编译Apache
安装Apache依赖后,编译时加多几个参数,重新编译Apache
$./configure –prefix=/usr/local/apache/\
–with-apr=/usr/local/apr \
–with-apr-util=/usr/local/apr-util \
–with-pcre=/usr/local/pcre
$make && make install
编译Apache模块
这里以mod_concatx为例,说明如何编译Apache模块,步骤很简单。mod_concatx是apache模块,可以用来合并多个js/css,有效提高js/css加载速度
编译 mod_concatx 模块
$ wget
$ ln -s/usr/local/apache/bin/apxs /usr/local/bin/apxs
$ apxs -cmod_concatx.c
编译并安装mod_concatx 模块
$apxs -iacmod_concatx.c
这种编译方式会自动安装Apache模块,安装成功后,可以在Apache 模块目录找到 mod_concatx.so,并且 conf/httpd.conf 配置也会加上mod_concatx 模块信息
启动Apache
$/usr/local/apache/bin/httpd -k start
注:Apache启动后,,以后台服务运行。如果想关闭Apache, 就使用以下命令:
$ /usr/local/apache/bin/httpd -k stop
查看已加载的Apache模块
$ /usr/local/apache/bin/httpd -MLoaded Modules:core_module (static)so_module (static)http_module (static)mpm_event_module (static)authn_file_module (shared)authn_core_module (shared)authz_host_module (shared)authz_groupfile_module (shared)authz_user_module (shared)authz_core_module (shared)access_compat_module (shared)auth_basic_module (shared)reqtimeout_module (shared)filter_module (shared)mime_module (shared)log_config_module (shared)env_module (shared)headers_module (shared)setenvif_module (shared)version_module (shared)unixd_module (shared)status_module (shared)autoindex_module (shared)dir_module (shared)alias_module (shared)concatx_module (shared)
说明mod_concatx已加载!
Apache无法正常运行的解决办法1. 80端口被占用
$ netstat -anp | grep :80
找到占用端口的Pid,kill掉即可。
2. 防火墙默认禁用80端口
$ vi /etc/sysconfig/iptables
加多一行记录
-A RH-Firewall-1-INPUT -p tcp -m state –state NEW -m tcp –dport 80 -j ACCEPT
保存后,重启防火墙。
$ service iptables restart
2015/6/11 补充Linux下Apache无法正常运行的解决办法
参考:
我们可以冷静理智的给这些刺一一贴上标签:骄傲,自负,脆弱的自尊心,