標籤:des style http os io 檔案 for art
-
在官網下載 源碼包
apr-1.5.1.tar.gz
apr-util-1.5.3.tar.gz
httpd-2.4.10.tar.gz
-
安裝使用者是root
解壓命令 tar -zxvf httpd-2.4.10.tar.gz
-
源碼安裝 apr ,apr-util
./configure --prefix=/usr/local/apr
報錯:rm: cannot remove `libtoolT‘: No such file or directory
我直接忽略了,網上看有修改configure 解決這個 問題,此處沒有嘗試
make
make install
./configure --prefix=/usr/local/apr-util \
--with-apr=/usr/local/apr
make
make install
4 源碼安裝apache
4.1 安裝
./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-dav --enable-module=so --enable-mods-shared=allmakemake install
4.2 修改原80連接埠為8008
備份 cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak
修改點: Listen 8008
ServerName http://localhost:8008
4.3啟動apache
/usr/local/apache/bin/apachectl start
curl http://127.0.0.1:8008
看到 <html><body><h1>It works!</h1></body></html>
成功
4.4配置 apachectl status 命令
備份cp /usr/local/apache/conf/extra/httpd-info.conf /usr/local/apache/conf/extra/httpd-info.conf.bak修改httpd-info.conf整個檔案修改如下## Get information about the requests being processed by the server# and the configuration of the server.## Required modules: mod_authz_core, mod_authz_host,# mod_info (for the server-info handler),# mod_status (for the server-status handler)## Allow server status reports generated by mod_status,# with the URL of http://servername/server-status# Change the ".example.com" to match your domain to enable.<Location /server-status> SetHandler server-status Order deny,allow #Deny from all Allow from all # Require host .example.com # Require ip 127</Location>## ExtendedStatus controls whether Apache will generate "full" status# information (ExtendedStatus On) or just basic information (ExtendedStatus# Off) when the "server-status" handler is called. The default is Off.##ExtendedStatus OnExtendedStatus On<IFModule mod_info.c><Location /server-info> SetHandler server-info Order deny,allow #Deny from all Allow from all</Location></IFModule>## Allow remote server configuration reports, with the URL of# http://servername/server-info (requires that mod_info.c be loaded).# Change the ".example.com" to match your domain to enable.#
修改http.conf
首先檢查檔案裡有沒有
LoadModule status_module modules/mod_status.so
如果沒有,需要重新編譯 搜尋
mod_status.so 可能是./configure 命令和apapche 版本問題
然後修改設定檔,使httpd-info.conf 生效
# Real-time info on requests and configuration#Include conf/extra/httpd-info.confInclude conf/extra/httpd-info.conf
最後修改/usr/local/apache/bin/apachectl
#STATUSURL=" 改為下面STATUSURL="http://localhost:8008/server-status"
./apachectl status 配置完成
4.5 apache 配置系統服務
# cp /usr/local/apache/bin/apachectl /etc/init.d/httpd # cp /usr/local/apache/bin/apachectl /usr/local/bin/httpd# ln -s /etc/init.d/httpd /etc/rc.d/rc5.d/S61httpd# ln -s /etc/init.d/httpd /etc/rc.d/rc4.d/S61httpd# ln -s /etc/init.d/httpd /etc/rc.d/rc3.d/S61httpd 開啟/etc/init.d/httpd檔案在#!/bin/bash下面加入 #chkconfig:345 61 61 #description:Apache 執行chkconfig --list |grep httpd就會出現httpd服務開機運行在345層級註冊服務 chkconfig --add httpd設定啟動層級 chkconfig --levels 345 httpd on
4.6 在非本機訪問apache 在防火牆開啟8008連接埠
/etc/sysconfig/iptables
添加
-A INPUT -p tcp -m state --state NEW -m tcp --dport 8008 -j ACCEPT
重啟iptable
/etc/init.d/iptables restart
查看iptable 狀態
/etc/init.d/iptables status
完工。
參考了很多網上的資料,謝謝前輩們~~~~