Apache编译安装
来源:互联网 发布:大长腿知乎 编辑:程序博客网 时间:2024/06/14 18:21
下载
[root@localhost ~]# cd /usr/local/src/[root@localhost src]# lsmysql-5.6.29-linux-glibc2.5-x86_64.tar.gz [root@localhost src]# wget http://mirrors.hust.edu.cn/apache/httpd/httpd-2.2.31.tar.bz2--2016-08-01 01:22:13-- http://mirrors.hust.edu.cn/apache/httpd/httpd-2.2.31.tar.b z2正在解析主机 mirrors.hust.edu.cn... 202.114.18.160正在连接 mirrors.hust.edu.cn|202.114.18.160|:80... 已连接。已发出 HTTP 请求,正在等待回应... 200 OK长度:5610489 (5.3M) [application/octet-stream]正在保存至: “httpd-2.2.31.tar.bz2”2016-08-01 01:22:44 (180 KB/s) - 已保存 “httpd-2.2.31.tar.bz2” [5610489/5610489])[root@localhost src]# lshttpd-2.2.31.tar.bz2 mysql-5.6.29-linux-glibc2.5-x86_64.tar.gz
解压
[root@localhost src]# tar jvxf httpd-2.2.31.tar.bz2[root@localhost src]# lshttpd-2.2.31 httpd-2.2.31.tar.bz2 mysql-5.6.29-linux-glibc2.5-x86_64.tar.gz
查看INSTALL文件
[root@localhost src]# cd httpd-2.2.31[root@localhost httpd-2.2.31]# lsABOUT_APACHE config.layout httpd.spec LICENSE README.platformsacinclude.m4 configure include Makefile.in README-win32.txtApache.dsw configure.in INSTALL Makefile.win ROADMAPbuild docs InstallBin.dsp modules serverBuildAll.dsp emacs-style LAYOUT NOTICE srclibBuildBin.dsp httpd.dep libhttpd.dep NWGNUmakefile supportbuildconf httpd.dsp libhttpd.dsp os testCHANGES httpd.mak libhttpd.mak README VERSIONING[root@localhost httpd-2.2.31]# vim INSTALL
为了避免出错,先安装一些库文件
[root@localhost httpd-2.2.31]# yum install -y zlib-devel[root@localhost httpd-2.2.31]# yum install -y pcre pcre-devel apr apr-devel
配置编译参数
[root@localhost httpd-2.2.31]# ./configure \> --prefix=/usr/local/apache2 \> --with-included-apr \> --enable-so \> --enable-deflate=shared \> --enable-expires=shared \> --enable-rewrite=shared \> --with-pcrechecking for chosen layout... Apachechecking for working mkdir -p... yeschecking build system type... x86_64-unknown-linux-gnuchecking host system type... x86_64-unknown-linux-gnuchecking target system type... x86_64-unknown-linux-gnuConfiguring Apache Portable Runtime library ...configuring package in srclib/apr nowchecking build system type... x86_64-unknown-linux-gnuchecking host system type... x86_64-unknown-linux-gnuchecking target system type... x86_64-unknown-linux-gnuConfiguring APR libraryPlatform: x86_64-unknown-linux-gnuchecking for working mkdir -p... yesAPR Version: 1.5.2checking for chosen layout... aprchecking for gcc... nochecking for cc... nochecking for cl.exe... noconfigure: error: in `/usr/local/src/httpd-2.2.31/srclib/apr':configure: error: no acceptable C compiler found in $PATHSee `config.log' for more detailsconfigure failed for srclib/apr
出错了……
解决方案:
[root@localhost httpd-2.2.31]# yum install gcc
重新配置编译参数
[root@localhost httpd-2.2.31]# ./configure \> --prefix=/usr/local/apache2 \> --with-included-apr \> --enable-so \> --enable-deflate=shared \> --enable-expires=shared \> --enable-rewrite=shared \> --with-pcre[root@localhost httpd-2.2.31]# echo $?0
编译和安装
[root@localhost httpd-2.2.31]# make[root@localhost httpd-2.2.31]# echo $?0[root@localhost httpd-2.2.31]# make install[root@localhost httpd-2.2.31]# echo $?0
安装后
[root@localhost httpd-2.2.31]# ls /usr/local/apache2/bin cgi-bin error icons lib man modulesbuild conf htdocs include logs manual
启动Apache
[root@localhost httpd-2.2.31]# /usr/local/apache2/bin/apachectl starthttpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName[root@localhost httpd-2.2.31]# ps aux |grep httpdroot 52131 0.0 0.1 37556 1788 ? Ss 02:48 0:00 /usr/local/apache2/bi n/httpd -k startdaemon 52132 0.0 0.1 37688 1260 ? S 02:48 0:00 /usr/local/apache2/bi n/httpd -k startdaemon 52133 0.0 0.1 37688 1260 ? S 02:48 0:00 /usr/local/apache2/bi n/httpd -k startdaemon 52134 0.0 0.1 37688 1260 ? S 02:48 0:00 /usr/local/apache2/bi n/httpd -k startdaemon 52135 0.0 0.1 37688 1260 ? S 02:48 0:00 /usr/local/apache2/bi n/httpd -k startdaemon 52136 0.0 0.1 37688 1260 ? S 02:48 0:00 /usr/local/apache2/bi n/httpd -k startroot 52138 0.0 0.0 103316 896 pts/0 S+ 02:52 0:00 grep httpd[root@localhost httpd-2.2.31]# netstat -lnpActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program nametcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1335/sshdtcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1682/mastertcp 0 0 :::3306 :::* LISTEN 1578/mysqldtcp 0 0 :::80 :::* LISTEN 52131/httpdtcp 0 0 :::22 :::* LISTEN 1335/sshdtcp 0 0 ::1:25 :::* LISTEN 1682/masterActive UNIX domain sockets (only servers)Proto RefCnt Flags Type State I-Node PID/Program name Pathunix 2 [ ACC ] STREAM LISTENING 11827 1578/mysqld /tmp/mysql. sockunix 2 [ ACC ] STREAM LISTENING 11460 1260/dbus-daemon /var/run/db us/system_bus_socketunix 2 [ ACC ] STREAM LISTENING 9110 1/init @/com/ubunt u/upstartunix 2 [ ACC ] STREAM LISTENING 12046 1682/master public/clea nupunix 2 [ ACC ] STREAM LISTENING 12053 1682/master private/tls mgrunix 2 [ ACC ] STREAM LISTENING 12057 1682/master private/rew riteunix 2 [ ACC ] STREAM LISTENING 12061 1682/master private/bou nceunix 2 [ ACC ] STREAM LISTENING 12065 1682/master private/def erunix 2 [ ACC ] STREAM LISTENING 12069 1682/master private/tra ceunix 2 [ ACC ] STREAM LISTENING 12073 1682/master private/ver ifyunix 2 [ ACC ] STREAM LISTENING 12077 1682/master public/flus hunix 2 [ ACC ] STREAM LISTENING 12081 1682/master private/pro xymapunix 2 [ ACC ] STREAM LISTENING 12085 1682/master private/pro xywriteunix 2 [ ACC ] STREAM LISTENING 12089 1682/master private/smt punix 2 [ ACC ] STREAM LISTENING 12093 1682/master private/rel ayunix 2 [ ACC ] STREAM LISTENING 12097 1682/master public/show qunix 2 [ ACC ] STREAM LISTENING 12101 1682/master private/err orunix 2 [ ACC ] STREAM LISTENING 12105 1682/master private/ret ryunix 2 [ ACC ] STREAM LISTENING 12109 1682/master private/dis cardunix 2 [ ACC ] STREAM LISTENING 12113 1682/master private/loc alunix 2 [ ACC ] STREAM LISTENING 12117 1682/master private/vir tualunix 2 [ ACC ] STREAM LISTENING 12121 1682/master private/lmt punix 2 [ ACC ] STREAM LISTENING 12125 1682/master private/anv ilunix 2 [ ACC ] STREAM LISTENING 12129 1682/master private/sca che
查看Apache工作模式
[root@localhost httpd-2.2.31]# /usr/local/apache2/bin/apachectl -Mhttpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerNameLoaded Modules: core_module (static) authn_file_module (static) authn_default_module (static) authz_host_module (static) authz_groupfile_module (static) authz_user_module (static) authz_default_module (static) auth_basic_module (static) include_module (static) filter_module (static) log_config_module (static) env_module (static) setenvif_module (static) version_module (static) mpm_prefork_module (static) http_module (static) mime_module (static) status_module (static) autoindex_module (static) asis_module (static) cgi_module (static) negotiation_module (static) dir_module (static) actions_module (static) userdir_module (static) alias_module (static) so_module (static) deflate_module (shared) expires_module (shared) rewrite_module (shared)Syntax OK
静态与动态模块
[root@localhost httpd-2.2.31]# ls /usr/local/apache2/modules/httpd.exp mod_deflate.so mod_expires.so mod_rewrite.so[root@localhost httpd-2.2.31]# ls /usr/local/apache2/bin/httpd/usr/local/apache2/bin/httpd[root@localhost httpd-2.2.31]# du -sh !$du -sh /usr/local/apache2/bin/httpd2.1M /usr/local/apache2/bin/httpd
只查看静态模块
[root@localhost httpd-2.2.31]# /usr/local/apache2/bin/apachectl –lCompiled in modules: core.c mod_authn_file.c mod_authn_default.c mod_authz_host.c mod_authz_groupfile.c mod_authz_user.c mod_authz_default.c mod_auth_basic.c mod_include.c mod_filter.c mod_log_config.c mod_env.c mod_setenvif.c mod_version.c prefork.c http_core.c mod_mime.c mod_status.c mod_autoindex.c mod_asis.c mod_cgi.c mod_negotiation.c mod_dir.c mod_actions.c mod_userdir.c mod_alias.c mod_so.c
配置文件
查看配置文件有没有语法错误
[root@localhost httpd-2.2.31]# /usr/local/apache2/bin/apachectl -thttpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerNameSyntax OK
配置文件
[root@localhost httpd-2.2.31]# ls /usr/local/apache2/conf/httpd.conf/usr/local/apache2/conf/httpd.conf
为了去掉一直提示的警告
httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
解决方案:
[root@localhost httpd-2.2.31]# vim /usr/local/apache2/conf/httpd.conf找到#ServerName www.example.com:80去掉注释并修改为ServerName localhost.localdomain
重新启动Apache
[root@localhost httpd-2.2.31]# /usr/local/apache2/bin/apachectl restart
restart与graceful的区别
- /usr/local/apache2/bin/apachectl restart
/usr/local/apache2/bin/apachectl graceful
restart杀掉进程再重新开启新的进程;graceful是原来的进程还在,只是重新加载了配置文件
0 0
- Apache编译与安装
- apache编译安装
- Archlinux 编译安装 Apache
- ubuntu 编译安装apache
- apache 安装编译参数
- Linux apache编译安装
- 编译安装apache
- 编译安装Apache+PHP
- 编译安装apache
- centos7编译安装apache
- apache编译安装
- Apache编译安装
- 编译安装apache
- Apache源码编译安装
- 编译安装apache
- centos7 Apache编译、安装
- 编译安装apache
- 编译安装Apache
- 从K近邻算法、距离度量谈到KD树、SIFT+BBF算法
- SDUT 2484 算术表达式的转换
- HTTP学习笔记——状态码
- 断点
- fastDFS安装
- Apache编译安装
- Vmware 配置Ubuntu网络NAT模式,桌面网络连接是灰色的
- 前缀、中缀、后缀表达式
- ubuntu配置opencv
- iOS_推送证书流程
- Java虚拟机
- 1. Two Sum
- AndroidStudio导入工程构建慢解决办法!
- javaEE