CentOS 6.5使用原始碼編譯安裝httpd服務
httpd是一個開源軟體,且一般用作web伺服器來使用。目前最流行的web伺服器軟體叫做httpd, 在早期的http server就叫做apache,到了http server 2.0以後就改名為httpd了。 所以有時候聽到apache伺服器和httpd伺服器其實都是指得是一個意思。
1、Apache的特點
功能強大、配置簡單、速度快、應用廣泛、效能穩定可靠,並可做代理伺服器或負載均衡來使用,
運用:
- 使用Apache執行靜態HTML網頁、圖片(處理靜態小檔案能力不及Nginx)。
- 使用Apache結合PHP引擎執行PHP、Perl、Python等程式
- 使用Apache結合Tomcat/Resion執行JSP,JAVA等程式
- 使用Apache作代理、負載均衡、rewrite規則過濾等等。
2、安裝開發包組
[[email protected]]#yum groupinstall "development tools"
[[email protected]]#yum install openssl-devel pcre-devel expat-devel
安裝需要的工具
yum install gcc
注意:安裝前檢查是否已經存在httpd、如果已經存在先解除安裝(使用rpm -e --nodeps)
[[email protected] /]# rpm -qa httpd rpm -e --nodeps 加 rpm -qa httpd 檢視到的包名 rpm命令-qa引數 -q 查詢的意思 -a 所有軟體包 -e 移除的意思 --nodeps 不做軟體間的依賴檢查 更過引數使用man rpm 或 rpm --help檢視
3、安裝Apache
下載httpd軟體包:wget http://mirror.bit.edu.cn/apache/httpd/httpd-2.4.34.tar.gz,如下,下載完成:
[[email protected] local]# wget http://mirror.bit.edu.cn/apache/httpd/httpd-2.4.34.tar.gz --2018-09-06 19:49:13-- http://mirror.bit.edu.cn/apache/httpd/httpd-2.4.34.tar.gz Resolving mirror.bit.edu.cn... 202.204.80.77, 2001:da8:204:2001:250:56ff:fea1:22 Connecting to mirror.bit.edu.cn|202.204.80.77|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 9098780 (8.7M) [application/octet-stream] Saving to: “httpd-2.4.34.tar.gz” 100%[======================================>] 9,098,780 188K/s in 53s 2018-09-06 19:50:06 (168 KB/s) - “httpd-2.4.34.tar.gz” saved [9098780/9098780]
解壓,測試安裝環境並編譯安裝:
解壓:tar zxvf httpd-2.4.34.tar.gz
然後進入加壓後的目錄:cd httpd-2.4.34,我們遇到不熟悉的軟體是可參考這兩個檔案:README INSTALL
[[email protected] httpd-2.4.34]# ls
ABOUT_APACHE CHANGES httpd.dsp LICENSE ROADMAP
acinclude.m4 CMakeLists.txt httpd.mak Makefile.in server
Apache-apr2.dsw config.layout httpd.spec Makefile.win srclib
Apache.dsw config.log include modules support
apache_probes.d config.nice INSTALL NOTICE test
ap.d configure InstallBin.dsp NWGNUmakefile VERSIONING
build configure.in LAYOUT os
BuildAll.dsp docs libhttpd.dep README
BuildBin.dsp emacs-style libhttpd.dsp README.cmake
buildconf httpd.dep libhttpd.mak README.platforms
[[email protected] httpd-2.4.34]# more README
Apache HTTP Server
What is it?
-----------
The Apache HTTP Server is a powerful and flexible HTTP/1.1 compliant
web server. Originally designed as a replacement for the NCSA HTTP
Server, it has grown to be the most popular web server on the
Internet. As a project of the Apache Software Foundation, the
developers aim to collaboratively develop and maintain a robust,
commercial-grade, standards-based server with freely available
source code.
The Latest Version
------------------
Details of the latest version can be found on the Apache HTTP
server project page under http://httpd.apache.org/.
Documentation
-------------
The documentation available as of the date of this release is
included in HTML format in the docs/manual/ directory. The most
up-to-date documentation can be found at
http://httpd.apache.org/docs/2.4/.
Installation
------------
Please see the file called INSTALL. Platform specific notes can be
found in README.platforms.
Licensing
---------
Please see the file called LICENSE.
Cryptographic Software Notice
-----------------------------
This distribution may include software that has been designed for use
with cryptographic software. The country in which you currently reside
may have restrictions on the import, possession, use, and/or re-export
to another country, of encryption software. BEFORE using any encryption
software, please check your country's laws, regulations and policies
concerning the import, possession, or use, and re-export of encryption
software, to see if this is permitted. See <http://www.wassenaar.org/>
for more information.
The U.S. Government Department of Commerce, Bureau of Industry and
Security (BIS), has classified this software as Export Commodity
Control Number (ECCN) 5D002.C.1, which includes information security
software using or performing cryptographic functions with asymmetric
algorithms. The form and manner of this Apache Software Foundation
distribution makes it eligible for export under the License Exception
ENC Technology Software Unrestricted (TSU) exception (see the BIS
Export Administration Regulations, Section 740.13) for both object
code and source code.
The following provides more details on the included files that
may be subject to export controls on cryptographic software:
Apache httpd 2.0 and later versions include the mod_ssl module under
modules/ssl/
for configuring and listening to connections over SSL encrypted
network sockets by performing calls to a general-purpose encryption
library, such as OpenSSL or the operating system's platform-specific
SSL facilities.
In addition, some versions of apr-util provide an abstract interface
for symmetrical cryptographic functions that make use of a
general-purpose encryption library, such as OpenSSL, NSS, or the
operating system's platform-specific facilities. This interface is
known as the apr_crypto interface, with implementation beneath the
/crypto directory. The apr_crypto interface is used by the
mod_session_crypto module available under
modules/session
for optional encryption of session information.
Some object code distributions of Apache httpd, indicated with the
word "crypto" in the package name, may include object code for the
OpenSSL encryption library as distributed in open source form from
<http://www.openssl.org/source/>.
The above files are optional and may be removed if the cryptographic
functionality is not desired or needs to be excluded from redistribution.
Distribution packages of Apache httpd that include the word "nossl"
in the package name have been created without the above files and are
therefore not subject to this notice.
Contacts
--------
o If you want to be informed about new code releases, bug fixes,
security fixes, general news and information about the Apache server
subscribe to the apache-announce mailing list as described under
<http://httpd.apache.org/lists.html#http-announce>
o If you want freely available support for running Apache please see the
resources at <http://httpd.apache.org/support.html>
o If you have a concrete bug report for Apache please see the instructions
for bug reporting at <http://httpd.apache.org/bug_report.html>
o If you want to participate in actively developing Apache please
subscribe to the `[email protected]' mailing list as described at
<http://httpd.apache.org/lists.html#http-dev>
[[email protected] httpd-2.4.34]# more INSTALL
APACHE INSTALLATION OVERVIEW
Quick Start - Unix
------------------
For complete installation documentation, see [ht]docs/manual/install.html or
http://httpd.apache.org/docs/2.4/install.html
$ ./configure --prefix=PREFIX
$ make
$ make install
$ PREFIX/bin/apachectl start
NOTES: * Replace PREFIX with the filesystem path under which
Apache should be installed. A typical installation
might use "/usr/local/apache2" for PREFIX (without the
quotes).
* Consider if you want to use a previously installed APR and
APR-Util (such as those provided with many OSes) or if you
need to use the APR and APR-Util from the apr.apache.org
project. If the latter, download the latest versions and
unpack them to ./srclib/apr and ./srclib/apr-util (no
version numbers in the directory names) and use
./configure's --with-included-apr option. This is required
if you don't have the compiler which the system APR was
built with. It can also be advantageous if you are a
developer who will be linking your code with Apache or using
a debugger to step through server code, as it removes the
possibility of version or compile-option mismatches with APR
and APR-Util code. As a convenience, prepackaged source-code
bundles of APR and APR-Util are occasionally also provided
as a httpd-2.X.X-deps.tar.gz download.
* If you are a developer building Apache directly from
Subversion, you will need to run ./buildconf before running
configure. This script bootstraps the build environment and
requires Python as well as GNU autoconf and libtool. If you
build Apache from a release tarball, you don't have to run
buildconf.
* If you want to build a threaded MPM (for instance worker)
on FreeBSD, be aware that threads do not work well with
Apache on FreeBSD versions before 5.4-RELEASE. If you wish
to try a threaded Apache on an earlier version of FreeBSD,
use the --enable-threads parameter to ./configure in
addition to the --with-mpm parameter.
* If you are building directly from Subversion on Mac OS X
(Darwin), make sure to use GNU Libtool 1.4.2 or newer. All
recent versions of the developer tools on this platform
include a sufficiently recent version of GNU Libtool (named
glibtool, but buildconf knows where to find it).
For a short impression of what possibilities you have, here is a
typical example which configures Apache for the installation tree
/sw/pkg/apache with a particular compiler and flags plus the two
additional modules mod_rewrite and mod_speling for later loading
through the DSO mechanism:
$ CC="pgcc" CFLAGS="-O2" \
./configure --prefix=/sw/pkg/apache \
--enable-rewrite=shared \
--enable-speling=shared
The easiest way to find all of the configuration flags for Apache 2.4
is to run ./configure --help.
Quick Start - Windows
---------------------
For complete documentation, see manual/platform/windows.html.en or
<http://httpd.apache.org/docs/2.4/platform/windows.html>
Postscript
----------
To obtain help with installation problems, please see the resources at
<http://httpd.apache.org/support.html>
Thanks for using the Apache HTTP Server, version 2.4.
The Apache Software Foundation
http://www.apache.org/
測試安裝環境: ./configure
[[email protected] httpd-2.4.34]# ./configure
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... no
configure: error: APR not found. Please read the documentation.
這裡報錯,缺少apr,下載apr及apr-util:
apr是Apache Portable Runtime的縮寫,中文譯為Apache可移植執行環境,是httpd所必須的,apr-util同理。
[[email protected] local]# wget http://mirrors.hust.edu.cn/apache//apr/apr-1.6.3.tar.gz
[[email protected] local]# wget http://mirrors.hust.edu.cn/apache//apr/apr-util-1.6.1.tar.gz
[[email protected] local]# tar -zxvf apr-1.6.3.tar.gz
[[email protected] local]# tar -zxvf apr-util-1.6.1.tar.gz
然後對apr進行安裝:
[[email protected] apr-1.6.3]# cd apr-1.6.3
[[email protected] apr-1.6.3]# ./configure
[[email protected] apr-1.6.3]# make && make install
然後對apr-util進行安裝:
[[email protected] local]# cd apr-util-1.6.1
[[email protected] apr-util-1.6.1]# ./configure --with-apr=/usr/local/apr/
[[email protected] apr-util-1.6.1]# make && make install
重新安裝httpd服務:
[[email protected] local]# cd httpd-2.4.34
[[email protected] httpd-2.4.34]# ./configure
[[email protected] httpd-2.4.34]# make && make install
稍等片刻後,安裝成功:
做軟連線:
[[email protected] apache2]# ln -s /usr/local/apache2/bin/* /usr/local/bin/
檢查:
[[email protected] apache2]# apachectl -t
AH00557: httpd: apr_sockaddr_info_get() failed for httpd
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK
[[email protected] apache2]# cd ./conf/
[[email protected] conf]# ls
extra httpd.conf magic mime.types original
[[email protected] conf]# pwd
/usr/local/apache2/conf
在這裡修改配置一下檔案
[[email protected] conf]# vim httpd.conf
修改:
ServerName www.httpd.com:80
儲存退出
[[email protected] conf]# apachectl -t
Syntax OK
然後啟動:apachectl start,出現如下問題:
[[email protected] conf]# apachectl start
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
說明80埠被佔用:
[[email protected] conf]# netstat -lnp|grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3624/nginx
unix 2 [ ACC ] STREAM LISTENING 22183 2809/nautilus /tmp/orbit-brz/linc-af9-0-20431005da76d
unix 2 [ ACC ] STREAM LISTENING 18180 2504/Xorg @/tmp/.X11-unix/X0
unix 2 [ ACC ] STREAM LISTENING 20735 2804/gconf-helper /tmp/orbit-brz/linc-af4-0-7e6a0173cda7a
ps -ef|grep httpd,或者用netstat -lnp|grep 80察看佔用的程序,可以發現nginx佔用著80埠,關閉其或者殺掉這個程序
[[email protected] sbin]# netstat -lnp|grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 4024/nginx
unix 2 [ ACC ] STREAM LISTENING 22183 2809/nautilus /tmp/orbit-brz/linc-af9-0-20431005da76d
unix 2 [ ACC ] STREAM LISTENING 18180 2504/Xorg @/tmp/.X11-unix/X0
unix 2 [ ACC ] STREAM LISTENING 20735 2804/gconf-helper /tmp/orbit-brz/linc-af4-0-7e6a0173cda7a
[[email protected] sbin]# kill -9 4024
[[email protected] sbin]# netstat -lnp|grep 80
unix 2 [ ACC ] STREAM LISTENING 22183 2809/nautilus /tmp/orbit-brz/linc-af9-0-20431005da76d
unix 2 [ ACC ] STREAM LISTENING 18180 2504/Xorg @/tmp/.X11-unix/X0
unix 2 [ ACC ] STREAM LISTENING 20735 2804/gconf-helper /tmp/orbit-brz/linc-af4-0-7e6a0173cda7a
[[email protected] sbin]# apachectl start
[[email protected] sbin]# lsof -i :80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd 67656 root 4u IPv6 257638 0t0 TCP *:http (LISTEN)
httpd 67657 daemon 4u IPv6 257638 0t0 TCP *:http (LISTEN)
httpd 67658 daemon 4u IPv6 257638 0t0 TCP *:http (LISTEN)
httpd 67659 daemon 4u IPv6 257638 0t0 TCP *:http (LISTEN)
[[email protected] sbin]# ps -ef | grep httpd
root 67656 1 0 23:02 ? 00:00:00 /usr/local/apache2/bin/httpd -k start
daemon 67657 67656 0 23:02 ? 00:00:00 /usr/local/apache2/bin/httpd -k start
daemon 67658 67656 0 23:02 ? 00:00:00 /usr/local/apache2/bin/httpd -k start
daemon 67659 67656 0 23:02 ? 00:00:00 /usr/local/apache2/bin/httpd -k start
root 67772 67293 0 23:04 pts/4 00:00:00 grep httpd
[[email protected] sbin]#
最後,檢視防火牆狀態,如果沒有關閉,關閉防火牆
[[email protected] sbin]# service iptables status
iptables: Firewall is not running.
service iptables status : 檢視防火牆的狀態
service iptables start : 啟動防火牆
service iptables stop : 停止防火牆
chkconfig iptables off :開機不載入防火牆
chkconfig iptables --level 35 on : 以35級別啟動伺服器開啟防火牆
相關推薦
CentOS 6.5使用原始碼編譯安裝httpd服務
httpd是一個開源軟體,且一般用作web伺服器來使用。目前最流行的web伺服器軟體叫做httpd, 在早期的http server就叫做apache,到了http server 2.0以後就改名為httpd了。 所以有時候聽到apache伺服器和httpd伺服器其實都是指得
centos 6.5下編譯安裝php-7.1.6和 php memcached擴展
php 編譯安裝 memcached 0,安裝 php-7.1.6 依賴包# yum groupinstall "Development tools" "Desktop Platform Development" # yum -y install openssl-devel libcurl-dev
CentOS-6 源碼編譯安裝httpd 2.4
啟動 app 源碼 apachectl eve pid nologin tar.bz2 yum 編譯httpd2.4 "註意:httpd2.4 依賴apr 1.4+以上 ,apr-util-1.4+以上" 1,解壓縮包至任意目錄 tar apr-1
超簡單!!centos 6離線原始碼編譯安裝升級gcc、binutils、automake、autoconf
centos 6系列的Linux發行版,是非常成功(具足UNIX精神)的發行版,可能大家都已經用得非常習慣了。 但問題是,其核心及附帶的工具軟體,版本卻都非常老了。 centos 7上的軟體版本雖然比較新,但centos 7設計風格的突變(主要是引入了很不符合UNIX精神的systemd),可能在業
CentOS 6.5 原始碼安裝Nginx1.6.3
一、軟體配置資訊 CentOS 6.5 nginx-1.6.3.tar.gz 二、必要軟體準備 檢查安裝pcre,openssl,gzip命令如下: yum install zlib zlib
CentOS 6.8下編譯安裝MySQL 5.6.14
CentOS 6.8下編譯安裝MySQL 5.6.14 概述: 通過原始碼安裝高版本的5.6.14。 正文: 一:解除安裝舊版本 使用下面的命令檢查是否安裝有MySQL Server rpm -qa | grep mysql 有的話通過下面的命令來解除安裝掉 目前我們查詢到的
CentOS 6.4下編譯安裝MySQL 5.6.14
概述: CentOS 6.4下通過yum安裝的MySQL是5.1版的,比較老,所以就想通過原始碼安裝高版本的5.6.14。 正文: 一:解除安裝舊版本 使用下面的命令檢查是否安裝有MySQL Server rpm -qa | grep mysql 有的話通過下面的命令來解除安裝掉 rpm -e
CentOS 6.8下編譯安裝MySQL 5.6.30
概述: CentOS 6.4下通過yum安裝的MySQL是5.1版的,比較老,所以就想通過原始碼安裝高版本的5.6.14。 正文: 一:解除安裝舊版本 使用下面的命令檢查是否安裝有MySQL Server rpm -qa | grep mysql 有的話通過下面的命令來解除
centos 6.5 zabbix 離線安裝歷程
zabbix環境:centos 6.5 + zabbix 2.4.6 + lanmp參考教程:http://www.jianshu.com/p/44d135f43eb2; http://www.68idc.cn/help/jiabenmake/qita/20150613365770.html
centos 6.5 一分鐘安裝mysql
linux mysql mysql centos 6.5 一分鐘安裝mysql手動執行wget https://dev.mysql.com/get/mysql57-community-release-el6-9.noarch.rpmrpm -Uvh mysql57-
centos 6.5系統下安裝ibus及設置開機自啟動
系統環境 tails src home 博客 技術分享 bus 快捷鍵 執行 先說一下系統環境:centos 6.5,然後我是以root身份執行的,沒有權限的用戶參見sudo用法 第1步:查找並安裝ibus安裝包,命令如下: 找到一行: ibus-pinyin.x86_6
CentOS 6.5下快速搭建ftp服務器[轉]
input eve 開機 sco 關閉 ftp用戶 指向 reject from CentOS 6.5下快速搭建ftp服務器 1、用root 進入系統 2、使用命令 rpm -qa|grep vsftpd 查看系統是否安裝了ftp,若安裝了vsftp,使用這個命令會
CentOS 6.5通過yum安裝mysql 5.5、5.6、5.7版本
yum安裝mysql mysql5.5 mysql5.6 mysql5.7 1、安裝mysql的yum源,這個源包括5.5、5.6、5.7版本:備註:如果要專門下載某個版本,可以到http://dev.mysql.com/downloads/repo/yum下載。[root@agile ~]#
CentOS 6.5 x64下查看服務版本
root imm eas 64位 fin size release arch 服務 1、查看服務是否是64位 [root@Yimmei ~]# getconf LONG_BIT 642、查看服務器版本信息 [root@Yimmei ~]# lsb_release -a
XEN虛擬化簡介及XEN在CentOS 6.5上的安裝
-m pointf err virtual splash server amd inter linux c 根據之前KVM虛擬化的整理,虛擬化技術分類如下:虛擬化技術的分類: (1) 模擬:Emulation Qemu, PearPC, Bochs
linux——編譯安裝httpd服務,同ip端口,不同域名
tor sbin 檢查 語法 list not src 不同 plist 1.環境,先關防火墻 [root@localhost ~]# systemctl status firewalld [root@localhost ~]# systemctl disable fire
CentOS 6.5用RPM安裝Nginx
一、作業系統 CentOS release 6.5 (Final) 二、下載Nginx 在官網:http://nginx.org/en/linux_packages.html#stable下載CentOS 6對應的RPM。 我下載的是nginx-release-centos-6-0.
CentOS 6 5下Redis安裝記錄
分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!  
CentOS 6.5下二進位制安裝 MySQL 5.6
1:檢視系統版本 1 2 [[email protected] mysql]# cat /etc/redhat-release CentOS release 6.5 (Final) 2:下載MySQL5.6二進位制包
原始碼編譯安裝Nginx服務
準備工作 1:下載原始碼包:nginx-1.14.0.tar.gz 2:解壓原始碼包: tar zxf nginx-1.14.0.tar.gz 3:cd nginx-1.14.0/src/core 4.vim nginx.h 為了在部署好nginx伺服器後,不讓客戶端訪問的時候知道我們