apache yum 安裝

來源:互聯網
上載者:User

標籤:網路連接   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 安裝

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.