nginx输出node pm2日志,实现浏览器查看日志内容(默认是下载)
root@demo18:/data/logs/pm2# ls -l1
2
3
4
5
6total 12
drwxr-xr-x 2 www www 4096 May 31 09:35 archiving
-rw-r--r-- 1 root root 0 May 31 09:35 cp1.demo.sundayle.com.err
-rw-r--r-- 1 root root 325 May 31 10:05 cp1.demo.sundayle.com.out
-rw-r--r-- 1 root root 0 May 31 09:35 cp.demo.sundayle.com.err
-rw-r--r-- 1 root root 3567 May 31 12:04 cp.demo.sundayle.com.out
root@demo18:/data/logs/pm2# cat /etc/nginx/other/log_output.types1
2
3
4
5types {
text/err err;
text/out out;
text/log log;
}
root@demo18:/data/logs/pm2# cat /etc/nginx/vhost/logs.sundayle.com.conf1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24server {
listen 80;
server_name logs.sundayle.com;
index index.html index.htm;
include other/log_output.types;
location / {
autoindex on;
autoindex_localtime on;
root /data/web/logs.sundayle.com;
add_header Cache-Control no-store;
add_header Pragma no-cache;
}
location /demo/ {
alias /data/logs/pm2/;
autoindex on;
autoindex_localtime on;
add_header Cache-Control no-store;
add_header Pragma no-cache;
}
access_log off;
}