Ps:http-2.4版本php
[root@localhost ~]# tar zxvf httpd-2.4.23.tar.gz -C /usr/src/nginx
[root@localhost ~]# cd /usr/src/httpd-2.4.23/
[root@localhost httpd-2.4.23]# ./configure --prefix=/usr/local/http --enable-so --with-rewriteweb
[root@localhost ~]# wget http://mirrors.hust.edu.cn/apache//apr/apr-1.6.3.tar.gz正則表達式
[root@localhost ~]# tar zxvf apr-1.6.3.tar.gzapache
[root@localhost ~]# cd apr-1.6.3
[root@localhost apr-1.6.3]# ./configure --prefix=/usr/local/aprwindows
[root@localhost apr-1.6.3]# make && make installapi
[root@localhost ~]# wget http://mirrors.hust.edu.cn/apache//apr/apr-util-1.6.1.tar.gztomcat
[root@localhost ~]# tar zxvf apr-util-1.6.1.tar.gz app
[root@localhost ~]# cd apr-util-1.6.1webapp
[root@localhost httpd-2.4.23]# ./configure --prefix=/usr/local/http --enable-so --with-rewrite --with-included-apr
[root@localhost apr-util-1.6.1]# make && make install
【問題彙總】
錯誤1: 提示錯誤,這個時候,咱們yum安裝的rpr軟件包彷佛不支持,所以須要編譯安裝
configure: error: APR not found. Please read the documentation.
錯誤2:configure: error: Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/.
[root@localhost ~]# cp -r apr-1.6.3 /usr/src/httpd-2.4.23/srclib/apr
[root@localhost ~]# cp -r apr-util-1.6.1 /usr/src/httpd-2.4.23/srclib/apr-util
# yum install -y apr apr-util apr-devel apr-util-devel
# ./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite
#make
# make install
PS:關於apache因此來的apr軟件包,所謂的apr也及時可移植運行庫,主要就是爲實現上層應用提供一個能夠跨操做系統底層的應用接口庫
apr接口庫是服務之間的調用的接口(api程序接口),好比說,php,tomcat,nginx
pcre是一個perl庫,Pcre出解決C語言中使用正則表達式的問題,在應用web服務時,是爲了解決支持HTTP Rewrite模塊
基於同一個IP和端口不一樣域名的方式在企業中應用普遍
開啓虛擬主機
<VirtualHost *:80>
DocumentRoot "/usr/local/httpd/htdocs/webapp1"
ServerName www.bxt01.net
<Directory "/usr/local/httpd/htdocs/webapp1">
Options All
AllowOverride None
Order allow,deny #先容許後拒絕規則
Allow from all #容許全部網段訪問
Deny from 192.168.2.129 #只拒絕2.129訪問請求
</Directory>
ErrorLog "/var/log/http/webapp1/error_log"
CustomLog "/var/log/http/webapp1/access_log" common
</VirtualHost>
DocumentRoot "/usr/local/httpd/htdocs/webapp2" ServerName www.bxy02.net <Directory "/usr/local/httpd/htdocs/webapp2"> Options All AllowOverride None Order deny,allow #訪問控制規則,先拒絕後容許 Deny from all #拒絕全部訪問請求 Allow from 192.168.2.129 #只容許該IP請求訪問2.129,同時可容許某個網段訪問,如容許192.168.2.0網段訪問,只需「Allow from 192.168.2.0/24」便可
</Directory> ErrorLog "/var/log/http/webapp2/error_log" CustomLog "/var/log/http/webapp2/access_log" common </VirtualHost>
Ps:關於訪問控制,針對網段限制,是沒法對本地windows客戶端有效的,好比說,你容許192.168.2.0網段訪問,其餘的都拒絕,其中本地windows客戶端(192.168.50網段)按理說是不能夠訪問的,可是也能夠訪問