11月27日任务

11月27日任务
12.10 Nginx访问日志
12.11 Nginx日志切割
12.12 静态文件不记录日志和过期时间
 
12.10 Nginx访问日志
0b461f0b0d61960f6eec85d7c5a2304e98b.jpg
[root @martin001 vhost]# vim test.com.conf
除了在主配置文件nginx.conf里定义日志格式外,还需要在虚拟主机配置文件中增加
access_log /tmp/test.com.log martin;
这里的combined_realip就是在nginx.conf中定义的日志格式名字
[root @martin001 vhost]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root @martin001 vhost]# /usr/local/nginx/sbin/nginx -s reload
[root @martin001 vhost]# curl -x127.0.0.1:80 test.com -I
HTTP/1.1 200 OK
Server: nginx/1.12.1
Date: Wed, 14 Mar 2018 15:39:14 GMT
Content-Type: text/html
Content-Length: 9
Last-Modified: Tue, 13 Mar 2018 16:20:55 GMT
Connection: keep-alive
ETag: "5aa7fa67-9"
Accept-Ranges: bytes
[root @martin001 vhost]# cat /tmp/test.com.log
127.0.0.1 - [14/Mar/2018:23:34:33 +0800] test2.com "/admin/index.html" 301 "-" "curl/7.29.0"
127.0.0.1 - [14/Mar/2018:23:39:14 +0800] test.com "/" 200 "-" "curl/7.29.0"
12.11 Nginx日志切割
61f3eeee35f4cd6a36aabf064801187ff94.jpg
[root@martin001 vhost]# vim /usr/local/sbin/nginx_log_rotate.sh
#! /bin/bash
d=date -d "-1 day" +%Y%m%d
logdir="/tmp/"
nginx_pid="/usr/local/nginx/logs/nginx.pid"
cd $logdir
for log in ls *.log
do
mv $log $log-$d
done
/bin/kill -HUP `cat $nginx_pid
[root@martin001 vhost]# ls /usr/local/nginx/logs/nginx.pid
/usr/local/nginx/logs/nginx.pid
[root@martin001 vhost]# ls /tmp/
mysql.sock
pear
php-fcgi.sock
systemd-private-d3d5de9693ed4f8ebbf3d1f91826a8cd-chronyd.service-zjb45v
systemd-private-d3d5de9693ed4f8ebbf3d1f91826a8cd-vgauthd.service-evgZ7p
systemd-private-d3d5de9693ed4f8ebbf3d1f91826a8cd-vmtoolsd.service-twe9Yk
test.com.log
test.com.log-20180313
[root@martin001 vhost]# crontab -e
no crontab for root - using an empty one
任务计划 crontab -e
0 0 * /bin/bash /usr/local/sbin/nginx_log_rotate.sh
12.12 静态文件不记录日志和过期时间
55a9491a5e1449a5b02687e71c274c068f6.jpg
[root@martin001 vhost]# cat test.com.conf
server
{
listen 80;
server_name test.com test1.com test2.com;
index index.html index.htm index.php;
root /data/wwwroot/test.com;
if ($host != 'test.com' ) {
rewrite ^/(. )$ http://test.com/$1 permanent;
}
access_log /tmp/test.com.log martin;
location ~ ..(gif|jpg|jpeg|png|bmp|swf)$
{
expires 7d;
access_log off;
}
location ~ .*.(js|css)$
{
expires 12h;
access_log off;
}
}
[root@martin001 vhost]# /usr/local/nginx/sbin/nginx -s reload
[root@martin001 vhost]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@martin001 vhost]# cd /data/wwwroot/test.com/
[root@martin001 test.com]# ls
index.html
[root@martin001 test.com]# vim 1.gif
[root@martin001 test.com]# vim 2.js
[root@martin001 test.com]# curl -x127.0.0.1:80 test.com/1.gif
dfgsdfgsdfgsdfg
[root@martin001 test.com]# curl -x127.0.0.1:80 test.com/2.js
dfasdfasdfasdf
[root@martin001 test.com]# curl -x127.0.0.1:80 test.com/index.html
test.com
[root@martin001 test.com]# cat /tmp/test.com.log
127.0.0.1 - [15/Mar/2018:00:19:27 +0800] test.com "/index.html" 200 "-" "curl/7.29.0"
[root@martin001 test.com]# curl -x127.0.0.1:80 test.com/index.html
test.com
[root@martin001 test.com]# cat /tmp/test.com.log
127.0.0.1 - [15/Mar/2018:00:19:27 +0800] test.com "/index.html" 200 "-" "curl/7.29.0"
127.0.0.1 - [15/Mar/2018:00:20:51 +0800] test.com "/index.html" 200 "-" "curl/7.29.0"
[root@martin001 test.com]# curl -x127.0.0.1:80 test.com/2.jsghfgfh
<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.12.1</center>
</body>
</html>
[root@martin001 test.com]# curl -x127.0.0.1:80 test.com/2.js -I
HTTP/1.1 200 OK
Server: nginx/1.12.1
Date: Wed, 14 Mar 2018 16:21:27 GMT
Content-Type: application/javascript
Content-Length: 15
Last-Modified: Wed, 14 Mar 2018 16:18:11 GMT
Connection: keep-alive
ETag: "5aa94b43-f"
Expires: Thu, 15 Mar 2018 04:21:27 GMT
Cache-Control: max-age=43200
Accept-Ranges: bytes
[root@martin001 test.com]# cat /tmp/test.com.log
127.0.0.1 - [15/Mar/2018:00:19:27 +0800] test.com "/index.html" 200 "-" "curl/7.29.0"
127.0.0.1 - [15/Mar/2018:00:20:51 +0800] test.com "/index.html" 200 "-" "curl/7.29.0"
127.0.0.1 - [15/Mar/2018:00:21:03 +0800] test.com "/2.jsghfgfh" 404 "-" "curl/7.29.0"

转载于:https://my.oschina.net/u/3960075/blog/2961786

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: "sim_ekb_install_2022_11_27" 是一个看起来像是一个软件或应用程序的命名。根据名称,它可能是一个"sim_ekb"(可能是一个模拟器或与SIM卡有关的应用程序)的安装包,版本是2022年1127发布的。 安装此软件可能需要以下几个步骤: 1. 首先,确保您的设备满足软件的系统要求。可以在软件的官方网站或文档中找到这些信息。 2. 下载sim_ekb_install_2022_11_27的安装包。通常,您可以在官方网站或其他可信的来源上找到该软件的下载链接。 3. 一旦下载完成,双击安装包文件来启动安装过程。 4. 按照向导的指示,选择安装路径和其他设置。 5. 点击“安装”按钮开始安装过程,并等待安装完成。 6. 安装完成后,您可以选择启动该软件,或在稍后的时间手动启动。 此外,如果您遇到任何安装过程中的问题,您可以查阅软件的文档或官方支持渠道,以获取适当的帮助和支持。 总的来说,无法确定"sim_ekb_install_2022_11_27"的具体细节,因为它可能是一个特定的软件或应用程序。因此,建议您参考相关的软件文档或联系软件提供商以获取更详细的信息和指导。 ### 回答2: "sim_ekb_install_2022_11_27" 是一个看起来像是一个安装/部署程序或软件的文件名称。根据该名称,可以推测它可能是指的某个关于2022年1127号在某个地方(可能是在新西伯利亚市)进行的SIM卡或移动设备的安装。SIM卡是用于移动通信的智能卡,它将用户的信息和移动网络运营商的服务连接在一起。安装SIM卡可能是指将该卡插入到移动设备中,以便使设备能够连接到运营商的网络并使用其服务。 具体而言,"sim_ekb_install_2022_11_27"可能意味着在2022年1127号,某个地方(可能是新西伯利亚市)进行了SIM卡或移动设备的安装。可能有一台设备或一批设备需要安装SIM卡,并通过完成一系列步骤将它们连接到运营商的网络。这些步骤可能包括检查设备是否与SIM卡兼容、插入SIM卡、验证连接、激活服务以及进行相关设置。可能还需要使用特定的安装程序或软件来完成这些任务。 总体来说,"sim_ekb_install_2022_11_27"是一个暗示了2022年1127号某个地方进行SIM卡或移动设备安装的文件名称。然而,由于缺乏更多具体的信息,很难给出更具体的解释。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值