国产片侵犯亲女视频播放_亚洲精品二区_在线免费国产视频_欧美精品一区二区三区在线_少妇久久久_在线观看av不卡

服務(wù)器之家:專注于服務(wù)器技術(shù)及軟件下載分享
分類導(dǎo)航

云服務(wù)器|WEB服務(wù)器|FTP服務(wù)器|郵件服務(wù)器|虛擬主機(jī)|服務(wù)器安全|DNS服務(wù)器|服務(wù)器知識|Nginx|IIS|Tomcat|

服務(wù)器之家 - 服務(wù)器技術(shù) - Nginx - Nginx實(shí)現(xiàn)瀏覽器可實(shí)時(shí)查看訪問日志的步驟詳解

Nginx實(shí)現(xiàn)瀏覽器可實(shí)時(shí)查看訪問日志的步驟詳解

2019-11-14 16:56daisy Nginx

我們經(jīng)常需要在頁面上實(shí)時(shí)查看nginx的日志輸出,并且能在頁面上顯示,那么下面小編就給大家說下怎么在瀏覽器上實(shí)時(shí)動態(tài)的查看nginx的訪問日志,有需要的朋友們可以參考借鑒。

一、首先查看nginx版本,我使用的是1.9.7的版本,安裝目錄在/application/nginx-1.9.7

?
1
2
3
4
[root@AnSheng ~]# /application/nginx-1.9.7/sbin/nginx -V
nginx version: nginx/1.9.7
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC)
configure arguments: --prefix=/application/nginx-1.9.7 --user=nginx --group=nginx --with-http_stub_status_module

二、檢查語法并啟動nginx

?
1
2
3
4
[root@AnSheng ~]# /application/nginx-1.9.7/sbin/nginx -t
nginx: the configuration file /application/nginx-1.9.7/conf/nginx.conf syntax is ok
nginx: configuration file /application/nginx-1.9.7/conf/nginx.conf test is successful
[root@AnSheng ~]# /application/nginx-1.9.7/sbin/nginx

三、把nginx配置文件內(nèi)多余的注視行和空行刪掉

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[root@AnSheng ~]# cd /application/nginx-1.9.7/conf/
[root@AnSheng conf]# egrep -v "#|^$" nginx.conf.default
worker_processes 1;
events {
 worker_connections 1024;
}
http {
 include mime.types;
 default_type application/octet-stream;
 sendfile on;
 keepalive_timeout 65;
 server {
  listen 80;
  server_name localhost;
  location / {
   root html;
   index index.html index.htm;
  }
  error_page 500 502 503 504 /50x.html;
  location = /50x.html {
   root html;
  }
 }
}
[root@AnSheng conf]# egrep -v "#|^$" nginx.conf.default nginx.conf

四、在nginx配置文件的server標(biāo)簽內(nèi)加入以下標(biāo)簽和內(nèi)容

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
location /logs {
 alias /application/nginx-1.9.7/logs;
 #Nginx日志目錄
 
 autoindex on;
 #打開目錄瀏覽功能
 
 autoindex_exact_size off;
 #默認(rèn)為on,顯示出文件的確切大小,單位是bytes
 #顯示出文件的大概大小,單位是kB或者M(jìn)B或者GB
 
 autoindex_localtime on;
 #默認(rèn)為off,顯示的文件時(shí)間為GMT時(shí)間。
 #改為on后,顯示的文件時(shí)間為文件的服務(wù)器時(shí)間
 
 add_header Cache-Control no-store;
 #讓瀏覽器不保存臨時(shí)文件
}

五、開啟在瀏覽器打開log文件,如果不開啟再點(diǎn)擊文件的時(shí)候就下載而不是打開

?
1
2
3
4
5
6
7
[root@AnSheng conf]# vim mime.types
types {
 text/html html htm shtml;
 text/log log;
 text/css css;
 text/xml xml;
 .............

六、檢測語法,然后讓nginx配置生效,在瀏覽器查看

?
1
2
3
4
[root@AnSheng conf]# /application/nginx-1.9.7/sbin/nginx -t
nginx: the configuration file /application/nginx-1.9.7/conf/nginx.conf syntax is ok
nginx: configuration file /application/nginx-1.9.7/conf/nginx.conf test is successful
[root@AnSheng conf]# /application/nginx-1.9.7/sbin/nginx -s reload

打開瀏覽器輸入域名或者IP,后面加上logs,然后點(diǎn)擊文件就可以打開了,如果日志隨隨便便就可以被別人查看是不是很不安全,所以我們要在加一層nginx用戶認(rèn)證。

Nginx實(shí)現(xiàn)瀏覽器可實(shí)時(shí)查看訪問日志的步驟詳解

Nginx實(shí)現(xiàn)瀏覽器可實(shí)時(shí)查看訪問日志的步驟詳解

七、安裝httpd-tools,用于帳號密碼生成

?
1
[root@AnSheng ~]# yum -y install httpd-tools

八、創(chuàng)建認(rèn)證的賬號

?
1
2
3
4
5
[root@AnSheng ~]# htpasswd -c /application/nginx-1.9.7/conf/loguser loguser
New password:
Re-type new password:
Adding password for user loguser
#密碼需要輸入兩次

九、編輯nginx配置文件,在logs的location加入下面的內(nèi)容

?
1
2
3
4
5
6
7
8
9
10
11
12
location /logs {
 ......
 alias PATH;
 autoindex on;
 autoindex_exact_size off;
 autoindex_localtime on;
 add_header Cache-Control no-store;
 auth_basic "Restricted";
 #Nginx認(rèn)證
 auth_basic_user_file /application/nginx-1.9.7/conf/loguser;
 #認(rèn)證賬號密碼保存的文件
}

十、然后再打開的時(shí)候就會提示輸入賬號和密碼,登陸之后才可以查看。

Nginx實(shí)現(xiàn)瀏覽器可實(shí)時(shí)查看訪問日志的步驟詳解

十一、總結(jié)

以上就是利用Nginx實(shí)現(xiàn)瀏覽器可實(shí)時(shí)查看訪問日志的全部步驟,希望對大家的學(xué)習(xí)或者工作有所幫助,如果有疑問大家可以留言交流。

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 久久亚洲一区 | 国产一区二区三区免费播放 | 欧美一区永久视频免费观看 | 亚洲第一色 | 中文字幕在线视频观看 | 精品国产乱码久久久久久牛牛 | 日韩精品色 | 亚洲欧美日韩精品久久奇米色影视 | 中国黄色片在线观看 | 久久久一区二区精品 | 日韩av中文 | 欧美在线视频日韩 | 日韩精品视频在线播放 | 国产日韩欧美精品 | 国产福利视频在线观看 | 91精品国产91久久综合桃花 | 欧美综合色 | 欧美综合一区 | 五月婷婷丁香 | 深夜影院深a | 久久综合成人精品亚洲另类欧美 | 午夜小视频在线观看 | 国产精品视频专区 | 精品超碰 | 中文字幕视频在线观看 | 亚洲精品乱码久久久久久蜜桃不爽 | 97久久久| 国产精品一区二区三区在线播放 | 亚洲欧美日韩在线 | 激情毛片| 91在线视频导航 | 婷婷亚洲五月 | 国产黄色一级大片 | 国产亚洲精品精品国产亚洲综合 | 免费在线黄色电影 | 精品久久久av| 日本 欧美 国产 | 亚洲成人av在线 | 偷拍一区二区三区 | 久久精品小视频 | 国产精品日本一区二区不卡视频 |