標籤:網路連接 ip地址 common 管理員 根目錄
yum -y install httpd-manual httpd
#ServerName www.example.com:80 #網站的FQDN
DocumentRoot "/var/www/html" #網頁文檔的根目錄
DirectoryIndex index.html index.html.var #預設的首頁
ErrorLog logs/error_log#錯誤記錄檔檔案的位置
#CustomLog logs/access_log common #訪問記錄檔的位置
Listen 80 #監聽的IP地址、連接埠號碼
PidFile run/httpd.pid #儲存httpd進程PID號的檔案
ServerRoot "/etc/httpd" 服務類別目錄
ServerAdmin [email protected] #管理員郵箱
User apache #服務進程的屬主
Group apache #服務進程的屬組
Timeout 120#網路連接逾時
KeepAlive Off #是否保持串連
MaxKeepAliveRequests 100 #每次串連最大處理的請求書
KeepAliveTimeout 15 #保持串連的逾時時限
<Directory "/var/www/html">
# Options Indexes FollowSymLinks #注釋掉此行
Options None #禁用自動索引
</Directory>
允許所有
<Directory "/var/www/html">
Order allow,deny
Allow from all
</Directory>
只允許一個網段訪問
<Directory "/var/www/html">
Order allow,deny
Allow from 192.168.1.0/24
</Directory>
使用者授權訪問
htpasswd -c /etc/httpd/auth.ulist 使用者名稱
設定密碼
<Directory "/var/www/html">
AuthName “Need Authorization!!" #認證領網域名稱稱,用於彈窗提示
AuthType basic #認證類型為basic
AuthUserFile /etc/httpd/auth.ulist #使用者資料檔案的路徑
Require valid-user #有效授權使用者都可以訪問
</Directory>
AWStats網站日誌分析
tar zxf awstats-7.1.tar.gz
mv awstats-7.1 /usr/local/awstats
cd /usr/local/awstats/tools/ #切換到工具目錄
./awstats_configure.pl #執行配置指令碼
y
/etc/httpd/conf/httpd.conf #指定Web配置路徑
y #同意建立新的網站配置
www.zongxuan.com #指定網站名稱
#直接斷行符號,接受預設配置路徑 /etc/awstats
#直接斷行符號
#直接斷行符號
vim /etc/awstats/awstats.www.zongxuan.com.conf
#LogFile="/var/log/httpd/mylog.log" #注釋掉此行
LogFile="/var/log/httpd/access_log" #添加此行
DirData="/var/lib/awstats" #確認統計資料的存放路徑
mkdir /var/lib/awstats/ #建立資料目錄
cd /usr/local/awstarts/tools/
./awstats_updateall.pl now
crontab -e
*/5 * * * * /usr/local/awstats/tools/awstats_updateall.pl now
限制使用
<Directory "/usr/local/awstats/wwwroot">
Options None
AllowOverride None
Order allow,deny
Allow from 192.168.5.0/24
</Directory>
vim /var/www/html/aw.html
<html>
<head>
<meta http-equiv=refresh content="0;
url=http://192.168.1.254/awstats/awstats.pl?config=www.zongxuan.com">
</head>
<body> </body>
</html>
http://www.zongxuan.com/aw.html
apache yum 安裝