亚洲精品日韩欧美_欧美二区乱c少妇_中文字幕日韩在线播放_日韩不卡中文字幕

English |
  • 美國VPS主機推薦
  • |
  • 代購服務
  • |
  • 10美元以下VPS
  • |
  • VPS新手指南/教程
  • |
  • 留言板
  • |
  • 關于
  • | 登錄 |

    LNMP使用Awstats分析Nginx日志[轉載]

    2010年07月18日 下午 | 作者:VPS偵探

    Awstats的運行需要PERL的支持,因為Nginx對PERL支持很弱,只能通過生成Html方式來輸出統計。

    首先,需要每日切割日志文件。提供個腳本給大家

    mv /usr/local/nginx/www.5dft.com.log /usr/local/nginx/logs/access5dft_`date +%Y%m%d`.log

    killall –s USR1 nginx #使用USR1參數通知Nginx進程切換日志文件

    很簡單,兩行實現切割。別問我格式,我網上抄來的。太困了,爭取最快時間寫完。

    然后到某開源網wget回來,解壓即可。我放到/usr/local/里面了,別問為什么,我習慣。

    接下來的內容非常非常重要,大家睜大眼睛看清楚。修改日志配置為以下格式(具體位置在/usr/local/nginx/conf/你的網 址.conf):

    log_format? www.5dft.com? '$remote_addr - $remote_user [$time_local] "$request" '
    '$status $body_bytes_sent "$http_referer" '
    '"$http_user_agent" "$http_x_forwarded_for"';

    行了格式就是上面那樣,要問為什么?因為默認格式Awstats不認。o(╯□╰)o

    在剛剛解壓回來的文件里面的tools找到awstats_configure.pl并執行開始配置。

    -----> Check for web server install
    Enter full config file path of your Web server.
    Example: /etc/httpd/httpd.conf
    Example: /usr/local/apache2/conf/httpd.conf
    Example: c:\Program files\apache group\apache\conf\httpd.conf
    Config file path ('none' to skip web server setup):
    #> none??#因為我們這里用的是 Nginx,所以寫 none,跳過。
    回車
    Your web server config file(s) could not be found.
    You will need to setup your web server manually to declare AWStats
    script as a CGI, if you want to build reports dynamically.
    See AWStats setup documentation (file docs/index.html)
    -----> Update model config file '/usr/local/awstats/wwwroot/cgi-bin/awstats.model.conf'
    File awstats.model.conf updated.
    -----> Need to create a new config file ?
    Do you want me to build a new AWStats config/profile
    file (required if first install) [y/N] ?
    #> y? ? ? ? #y 創建一個新的統計配置
    回 車
    -----> Define config file name to create
    What is the name of your web site or profile analysis ?
    Example: www.mysite.com
    Example: demo
    Your web site, virtual server or profile name:
    #> www.5dft.com? ? ? ? ? ? ? ? #統計網站的域名
    回車
    -----> Define config file path
    In which directory do you plan to store your config file(s) ?
    Default: /etc/awstats
    Directory path to store config file(s) (Enter for default):
    #>
    使用默認直接回車,接下來便會出現以下的提示
    ----> Add update process inside a scheduler
    Sorry, configure.pl does not support automatic add to cron yet.
    You can do it manually by adding the following command to your cron:
    /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.5dft.com
    #回頭把該命令填入crontab 按指定時間執行
    Or if you have several config files and prefer having only one command:
    /usr/local/awstats/tools/awstats_updateall.pl now
    Press ENTER to continue...? ? ? ? ? ? ? ? 回車繼續

    【上面從別的地方摘來的,別問從哪摘,N個網站都這篇文章我哪知道出處?反正我是上面少了一個步驟,少了個回車,其它正常。繼續】

    接下來就生成了個文件了。我的是在/etc/awstats/awstats.www.5dft.com.conf

    在那個文件找到統計的日志文件的路徑
    LogFile="/var/log/httpd/mylog.log"
    改為
    LogFile="/opt/nginx/logs/access5dft_%YYYY-0%MM-0%DD-0.log

    對應上邊 Nginx 日志切割程序的所生成的目錄存放結構,要注意 Awstats 的年月日格式的跟 Nginx 的寫法有所不同。我們現在執行統計的順序是:
    Nginx 產生日志 –> 日志切割 –> Nginx 繼續產生日志 –> 另存切割日志 –> 交由Awstats統計 –> 生成結果
    在本文中 Awstats 所統計的日志,是已切下來的那部分。也能調轉順序,先統計完了再切。不過這比較容易造成統計的遺漏。配置修改完成后,保存退出。然后我們可以開始試一下手 動執行。

    先執行日志切割腳本 logcron.sh 把 Nginx 的日志切下來。

    然后執行 Awstats 日志更新程序開始統計分析。
    ./logcron.sh

    /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -update -config=www.5dft.com

    看到幾行類似

    Found 0 dropped records,
    Found 0 corrupted records,
    Found 0 old records,
    Found 120 new qualified records.

    就是成功了。如果沒有的話是缺少一個/var/lib什么什么的,mkdir一下就可以。我發現網上教程都少了這一步,耽誤小白啊。o(╯□╰)o 還好我是大白,很快解決。繼續。

    那么我們就必須建個文件夾來放文件咯。放在網站里面方便看。
    省略建文件夾步驟,繼續。

    /usr/local/awstats/tools/awstats_buildstaticpages.pl -update -config=www.5dft.com -lang=cn -dir=/home/wwwroot/5dft.com/xxx -awstatsprog=/usr/local/awstats/wwwroot/cgi-bin/awstats.pl

    上面的命令我不查資料還真不知道。awstats_buildstaticpages.pl是生成靜態頁面的。后面指定更新,后面語言CN,后面指 定生成靜態的目錄,后面awstats.pl是Awstats 日志更新程序路徑。

    請注意上面的命令是一行的,切勿分割或者別的什么的。
    把那個和分割日志的放進crontab即可完成任務。

    好了,到此任務基本完成。剩下的生成的文件要怎么加密就是你的問題了。我是懶蟲,試了幾次500之后我就直接改個復雜的文件夾名就完事了。但是別塞 進robot,否則...嘿嘿,別人一看就知道了。明白我意思吧?

    文件夾加密也不是很難,估計我抄錯資料了。太晚了不折騰,睡覺~~~

    轉載自:http://www.xinblog.info/post-72.html

    >>轉載請注明出處:VPS偵探 本文鏈接地址:http://www.0794baidu.com/manage/lnmp-awstats-nginx-logs.html
    VPS偵探推薦:
    遨游主機VultrLinode搬瓦工LOCVPSKVMLAHOSTKVMHostXen80VPS美國VPS主機,國內推薦騰訊云阿里云

    發表評論

    *必填

    *必填 (不會被公開)

    評論(4條評論)

    1. VPSer說道:

      @sunny, 這個不是錯誤。

    2. sunny說道:

      軍哥,分割日志后的error.log

      2010/08/31 00:00:09 [notice] 1335#0: signal process started

      請問這是什么錯誤,怎么解決? ?? ??

    主站蜘蛛池模板: 日本一区二区黄色| 欧美少妇一区| 亚洲97在线观看V| 亚洲精品免费av| 欧美在线欧美在线| 不卡视频一区二区| 久久精品美女| 欧美精品日韩三级| 亚洲欧洲国产精品久久| 国产自偷自偷免费一区| 午夜免费电影一区在线观看| 欧美精品久久久| 国产精品高清网站| 国产精品美女在线| 日韩中文字幕久久| 亚洲综合视频一区| 精品视频在线观看| 欧美日韩一区在线播放| 日韩视频精品| 精品一区二区不卡| 中文字幕在线观看一区二区三区| 国产精品久久久999| 日本高清久久天堂| 色黄久久久久久| 国产精品成人av在线| 九九热精品视频| 精品国产一区二区三区久久狼黑人| 亚洲国产精品毛片| 天堂资源在线亚洲视频| 97精品国产97久久久久久免费| 国产日韩欧美91| 国产精品免费在线播放| 国产日韩在线看| 国产伦精品一区二区三区视频免费| 国产精品久久激情| 国产伦精品一区二区三区视频免费| 一区二区在线高清视频| 伊人久久大香线蕉综合75| 欧美大片va欧美在线播放| 日韩av免费看网站| 国产精品麻豆va在线播放|