nginx dynamic view of the log

Scene: the server logs can be dynamically browse through the browser, easy to view the log leaders.

 

Analysis: nginx is to do a reverse proxy, log file download behavior changed browsing behavior.

 

achieve:

1. Generate a test account password

  . A mounting htpasswd: 

yum -y install httpd-tools

  b. password generation

  

# Into the / usr / local / nginx directory 
cd / usr / local / nginx 

# generate passwords 
htpasswd -c passwd test 
Enter password: test

  

  Generated passwd file is complete

 

2. Configure nginx check browsing

 

{/data.log LOCATION 
  # Authentication Configuration 
  auth_basic "Please passward the INPUT"; 
  auth_basic_user_file / usr / local / nginx / passwd; 
  # Browser Configuration 
  # nginx open the browser, nginx default does not allow entire directories listed 
  autoindex ON; 
  # default on, showing the exact size of the file, the unit is bytes. 
   After # to off, the file shows the approximate size of the unit is kB or MB or GB 
  autoindex_exact_size ON; 
  # default is off, the display file times are GMT time. 
  After the # to on, the time display file as a file server time 
  autoindex_localtime ON; 
  the add_header the Cache-Control Store-NO; 
}

  

 

 

Reference links:

https://blog.51cto.com/13590999/2094871

https://www.cnblogs.com/xzlive/p/9492879.html

https://www.cnblogs.com/xiaoyaojinzhazhadehangcheng/articles/8043269.html

Guess you like

Origin www.cnblogs.com/potatoChicken/p/11348278.html