背景:
最近项目出了一点奇怪的问题,好像是由于服务器防火墙uewaf
导致的,正常请求url地址时,返回如下相应头:
但是今天突然发现一个情况,某一个请求过后,导致再次请求该站点的相关地址会返回404
错误,由于不了解uewaf
,所以我想知道我的请求是否到达Nginx
服务器。
Nginx
配置如下
以下为本机win7下测试
(不相关的内容大部分已经去掉):
#user nobody;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
server {
listen 80;
server_name site.com;
#charset koi8-r;
access_log logs/host.access.log main;
location / {
#root html;
#index index.html index.htm;
proxy_pass http://192.168.3.3:6789;
proxy_redirect default ;
}
}
}
问题如下:
1、为什么我配置好Nginx转发的网址(http://192.168.3.3:6789)后,请求成功了(相应头里面包含Server:nginx/1.12.2
),但是Nginx
跟路径C:\nginx-1.12.2\logs
的日志文件access.log
、host.access.log
全部没有内容呢?
2、这两个日志文件分别是什么意呢,主要有什么差别呢?
1,一般服务器写日志都是有一个buffer的,先写buffer,buffer写完了再刷盘,不然磁盘受不了,你多刷个几十次,看看日志会不会写进去,或者reload下。
2,都是访问日志,只是 host.access.log 是你定义的 site.com 的server域下的访问日志,access.log 你定义在了http下面,就是所有的server默认的访问日志文件。 server下的配置会优先于http下的配置。