在Ubuntu上建立服務器環境(3):編譯安裝Apache,配置其在webmin裏可用

如果使用apt-get的方式安裝apache,會發現apache的安裝目錄很亂,而且並不是按照默認的apache目錄結構組織的,這給後期的配置造成了很大麻煩!
在編譯安裝apache之前,需要確定您的系統是否已經安裝gcc編譯環境和Zlib,如果沒有安裝您可以通過以前幾步安裝:
1、安裝gcc:sudo apt-get build-dep gcc
2、安裝zlib:apt-get install zlib1g-dev
3、下載apache2.2.14: sudo wget http://labs.xiaonei.com/apache-mirror/httpd/httpd-2.2.14.tar.gz
4、解壓apache:sudo tar -zxvf httpd-2.2.14.tar.gz
5、進入解壓出來的apache目錄:
sudo ./configure --prefix=/usr/server/apache --with-mysql=/usr/share/mysql --enable-so --enable-track-vars --enable-rewrite --with-zlib --enable-mods-shared=all --enable-suexec --with-suexec-caller=daemon --with-suexec-docroot=/var/www/wwwsource
其中後面是三個參數:--enable-suexec --with-suexec-caller=daemon --with-suexec-docroot=/var/www/wwwsource是爲安裝Extmail而準備的
6、sudo make
7、sudo make install
8、設置apache開機自啓動:
  1)複製 /usr/server/apache/bin/apachectl到/etc/init.d
  2)加載爲服務
       sudo update-rc.d apachectl defaults
9、在webmin裏設置apache模塊,因爲webmin中默認的設置是按照apt-get安裝apache的方式設置的,所以需要做適當的改動
  1)增加虛擬服務器的文件:/usr/server/apache/conf/extra/httpd-vhosts.conf
  2)Directory to create links in for new virtual servers 設爲none
  3)Apache服務器根目錄:/usr/server/apache
  4)httpd執行文件路徑:/usr/server/apache/bin/httpd
  5)命令apachectl的路徑:/usr/server/apache/bin/apachectl
  6)啓動apache命令:/usr/server/apache/bin/apachectl start
  7)停止apache命令:/usr/server/apache/bin/apachectl stop
  8)Command to apply configuration設爲:/usr/server/apache/bin/apachectl
  9)httpd.conf的路徑:/usr/server/apache/conf/httpd.conf
  10)srm.conf的路徑設爲自動
  11)access.conf的路徑設爲自動
  12)mime.types的路徑設爲:/usr/server/apache/conf/mime.types
  13)Environment file defining Apache variables 設爲;None

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