apache編譯安裝

來源:互聯網
上載者:User

標籤:

1,安裝

yum install zlib zlib-devel -ytar xf httpd-2.2.27.tar.gz cd httpd-2.2.27./configure --prefix=/application/apache2.2.27 --enable-deflate --enable-expires --enable-headers --enable-modules=most --enable-so --with-mpm=worker --enable-rewritemake && make installln -s /application/apache2.2.27/ /application/apache./configure --prefix=/application/apache2.2.27 --enable-deflate \  #壓縮--enable-expires \ #逾時--enable-headers \ #http頭--enable-modules=most --enable-so --with-mpm=worker \ #apache兩種模式,worker:進程下派線程,perform:進程提供服務--enable-rewritemake &&make installln -s /application/apache2.2.27/ /application/apache

檢查文法並啟動

/application/apache/bin/apachectl -t

/application/apache/bin/apachectl start

 

主設定檔

DocumentRoot "/application/apache2.2.27/htdocs"...
#開啟vhost配置Include conf
/extra/httpd-vhosts.conf...
Include conf/extra/httpd-mpm.conf  #預設perfork模式,如果開啟mpm就是worker模式
#防止啟動時候報錯fqdn錯ServerName
127.0.0.1 :80

 

虛擬機器主機配置

[[email protected] extra]# vim httpd-vhosts.conf
#虛擬機器主機支援,必須開啟NameVirtualHost
*:80<VirtualHost *:80> ServerAdmin 781647046@qq.com DocumentRoot "/var/html/www" ServerName www.lanny.com ServerAlias www.ma.com ErrorLog "logs/www-error_log" CustomLog "logs/www-access_log" common</VirtualHost><VirtualHost *:80> ServerAdmin 781647046@qq.com DocumentRoot "/var/html/blog" ServerName blog.lanny.com ServerAlias blog.ma.com ErrorLog "logs/blog-error_log" CustomLog "logs/blog-access_log" common</VirtualHost><VirtualHost *:80> ServerAdmin 781647046@qq.com DocumentRoot "/var/html/bbs" ServerName bbs.lanny.com ServerAlias bbs.ma.com ErrorLog "logs/bbs-error_log" CustomLog "logs/bbs-access_log" common</VirtualHost>嚴重注意:如果不加NameVirtualHost *:80如下會報錯.

 

虛擬機器主機403錯誤:

修改後追加到httpd.conf<Directory "/var/html">    AllowOverride None    Options None    Order allow,deny    Allow from all</Directory>

如果index.html或者訪問的檔案不存在也會報403錯誤

 

mkdir /var/html/{www,blog,bbs} -ptouch /var/html/{www,blog,bbs}/index.htmlfor i in www bbs blog;do echo "$i.lanny.com" > /var/html/$i/index.html;donefor i in www bbs blog;do cat /var/html/$i/index.html;done

 

 

 

strace命令:追蹤cpu為什麼很高.(一般是程式bug,有死迴圈等.)

strace /application/apache/bin/apachectl –M

 

apache編譯安裝

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.