一、安裝apache前準備,選擇一種即可:
1.更改系統自帶httpd服務
檢查該環境中是否已經存在httpd服務的配置檔案,預設儲存路徑:/etc/httpd/httpd.conf(這是centos預裝的apache的乙個ent版本,一般我們安裝源**版的apache)。如果已經存在/etc/httpd/httpd.conf,請先解除安裝或者關閉centos系統自帶的web服務,執行命令:chkconfig httpd off,再或者把centos自帶的httpd服務的80埠改為其他埠,只要不與我們安裝的apache服務的埠衝突就可以啦。
2.停止並解除安裝linux系統自帶的httpd服務:
3、kill -9 pid號(逐個刪除)
5、rpm -e httpd軟體包1.安裝apr
[root@localhost bin]# tar -zxf apr-1.4.5.tar.gz
[root@localhost apr-1.4.5]# ./configure --prefix=/usr/local/apr
[root@localhost apr-1.4.5]# make
[root@localhost apr-1.4.5]# make install
2.安裝apr-util
[root@localhost bin]# tar -zxf apr-util-1.3.12.tar.gz
[root@localhost apr-util-1.3.12]# ./configure --prefix=/usr/local/apr-util -with-apr=/usr/local/apr/bin/apr-1-config
[root@localhost apr-util-1.3.12]# make
[root@localhost apr-util-1.3.12]# make install
3.安裝pcre
[root@localhost ~]# unzip pcre-8.31.zip
[root@localhost ~]# cd pcre-8.31
[root@localhost pcre-8.31]# ./configure --prefix=/usr/local/pcre
[root@localhost pcre-8.31]# make[root@localhost pcre-8.31]# make install
4.編譯安裝httpd-2.4.3:
在安裝apache時,不同版本在編譯時configure後跟的引數不同。
httpd-2.4.3編譯命令:
./configure --prefix=/usr/local/apache2 --
with
-apr
=/usr/local/apr --
with
-apr
-util
=/usr/local/apr-util/--
with
-pcre
=/usr/local/pcre
make
make install
•啟動apache:/usr/local/apache2/bin/apachectl start
•停止apache:/usr/local/apache2/bin/apachectl stop
•重啟apache:/usr/local/apache2/bin/apachectl restart
**放在/usr/local/apache2/htdocs目錄下
5.驗證
搜尋」#servername」,新增servername localhost:80
在ie中通過http://localhost:80,如果看到頁面中顯示「it
works!」字樣,則代表apache驗證通過。
如果**的index字尾是php格式的,則要修改httpd.conf配置檔案(/usr/local/apache2/conf),在directoryindex增加index.php。
#
directoryindex: sets the
file that apache will serve if
adirectory
is requested.
#directoryindex index.html index.php
linux下解除安裝apach
1 確認是否安裝過,或者系統自帶了httpd服務 rpm qa grep httpd或者 yum list grep httpd2 停止httpd服務 已經停止服務的不用執行次命令 systemctl stop httpd.service3 解除安裝apache,通過rpm e或者yum erase...
CentOS7 6原始碼編譯安裝Apache
二 安裝apache 三 啟動httpd服務 四 驗證是否啟動成功 安裝apache之前,我們需要安裝編譯apache和所依賴的一些軟體包,其中有 gcc gcc c apr apr util pcre等包。安裝gcc gcc c 編譯環境 root localhost yum install gc...
Linux下編譯安裝openssl
wget 2 解壓壓縮包,例如 解壓到當前資料夾 tar zcvf openssl 1.0.1c.tar.gz c 解壓完後會生成openssl資料夾,如 openssl 1.0.1c。3 進入該資料夾,開啟install 檔案,可以看到安裝的具體步驟,按照這些步驟一步步做下來,就完成了openss...