Apache源碼編譯安裝

精髓前言:

解析JAVA程序用:tomcat、resin、weblogic、jboss

解析.asp .aspx程序用:pws,iis  後端數據庫爲:sql server,access


IP PV UV:

IP:internet protocol    --internet協議

pv:page view         --訪問量

uv:unique visitor      --獨立訪客


簡單介紹cookie:

cookie: 訪問一個網站的時候,網站就會給你發一個cookie,獨一無二的


什麼是併發:

a.網站服務器每秒最大接受用戶請求數

b.網站服務器每秒響應的請求數

c.a+b

併發理解:服務器能夠同時處理的最大連接數


web服務市場的主流:

靜態web服務:apache,nginx,iis,lighttpd,tengine

動態web服務:tomcat(中小企業),resin(大企業),php

==================================================================

php(gcgi)配合apache,php不是守護進程,而是mod_php5.so(module)  

配合Nginx,lighttpd,php守護進程模式,FCGIm模式。

==================================================================

Apache特點:穩點,安全,配置簡單,速度快,性能穩定可靠,可做代理服務器和負載均衡來使用。


# rpm -e --nodeps +服務    --卸載服務

====================================================================

編譯安裝Apache


安裝apache依賴包:

yum install zlib zlib-devel -y  安裝apache依賴包

Apache官網:(rpm包在官網下載)

https://www.apache.org/


解壓:

#tar xf httpd-2.2.27.tar.gz  


#cd httpd-2.2.27/

#./configure \

--prefix=/application/apache2.2.27 \  安裝的目錄

--enable-deflate \    

--enable-expores \ 緩存多久

--enable-headers \ http的頭

--enable-modules=most \激活http模塊

--enable-so \

--with-mpm=worker \ 併發大

--enable-rewrite 僞靜態


# echo $?  返回0就沒錯誤

# make & make install

啓動服務:
# /application/apache/bin/apachectl -start

查看80端口看httpd起來沒有

# lsof -i :80   

跟蹤進程的進度:

# strace /application/apache/bin/apachectl -M 


什麼是虛擬主機:

1:基於域名

2:基於IP

3:基於端口

=======================================================

列如:

域名        站點

www.a.org    /var/html/a/

www.b.com    /var/html/b/

www.c.cn    /var/html/c/


編輯配置文件配置虛擬主機:

# vim /application/apache/conf/extra/httpd-vhost

<VirtualHost *:80>

    ServerAdmin [email protected]

    DocumentRoot "/var/html/a"

    ServerName www.a.org

    ServerAlias a.org

    ErrorLog "logs/www-error_log"      

    CustomLog "logs/www-access_log" common

</VirtualHost>


<VirtualHost *:80>

    ServerAdmin [email protected]

    DocumentRoot "/var/html/b"

    ServerName www.b.org

    ServerAlias b.org

    ErrorLog "logs/www-error_log"      

    CustomLog "logs/www-access_log" common

</VirtualHost>


<VirtualHost *:80>

    ServerAdmin [email protected]

    DocumentRoot "/var/html/c"

    ServerName www.c.org

    ServerAlias c.org

    ErrorLog "logs/www-error_log"      

    CustomLog "logs/www-access_log" common

</VirtualHost>

上面配置了三個主機,訪問 # curl www.a.org 等三個網頁做測試


編輯主配置文件:

# vim /application/apache/conf/httpd.conf 

Include conf/extra/httpd-vhosts.conf --打開(默認是註釋掉的)

Include conf/extra/httpd-mpm.conf


編輯主配置添加一個容器

# vim /application/apache/conf/httpd.conf  

<Directory "/var/html">

        Options FollowSymLinks

        AllowOverride None

        Order allow,deny

        Allow from all

</Directory>


檢查語法:

# /application/apache/bin/apachectl -t 

平滑重啓,相當於reload:

# /application/apache/bin/apachect graceful 


apache日誌格式:

通用日誌格式(common log format)

組合日誌格式(combined log format)


apache 日誌輪詢

1.安裝工具cronolog

2.解壓 tar zxvf cronolog....... 

3.# ./configure make & make install 

4.# ll /usr/local/sbin/cronolog




alex將爲你們更新後面的PHP報錯解決方法,希望以上博文對各位Linux愛好者有用~~


              linux運維交流羣:288746884


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章