我有一个设置,其中一个nginx反向代理到第二个。
我在日志中观察到,一个nginx看到两个请求,但第二个只看到其中一个请求。我还观察到浏览器只发送一个请求,因此复制(如果存在)不是来自客户端。
以下是日志示例:
nginx_1 | 192.168.64.8 - - [15/Jul/2016:11:43:32 +0000] "GET /images/mypic1.jpg HTTP/1.0" 200 9402 "http://localhost/es" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36"
proxy_1 | 192.168.64.1 - - [15/Jul/2016:11:43:32 +0000] "GET /images/mypic1.jpg HTTP/1.1" 200 111773 "http://localhost/es" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36" "-"
proxy_1 | 192.168.64.1 - - [15/Jul/2016:11:43:32 +0000] "GET /images/mypic1.jpg HTTP/1.1" 200 111773 "http://localhost/es" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36"
proxy_1 | 192.168.64.1 - - [15/Jul/2016:11:43:32 +0000] "GET /images/mypic2.jpg HTTP/1.1" 200 25619 "http://localhost/es" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36" "-"
proxy_1 | 192.168.64.1 - - [15/Jul/2016:11:43:32 +0000] "GET /images/mypic2.jpg HTTP/1.1" 200 25619 "http://localhost/es" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36"
nginx_1 | 192.168.64.8 - - [15/Jul/2016:11:43:32 +0000] "GET /images/mypic2.jpg HTTP/1.0" 200 25619 "http://localhost/es" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36"
如您所见,proxy_1是nginx作为反向代理,nginx_1是接收和处理请求的那个。
在每个重复的行的末尾,你可以看到" - "我不知道这意味着什么。我怀疑是在进行某种改写,我不知道但不了解它是如何发生的。
你能告诉我一些关于这里发生了什么的线索吗?
这里我还提供了服务器配置:
access_log /dev/stdout;
error_log /dev/stdout;
server {
listen 7000;
listen 80;
client_max_body_size 24M;
server_name *.rareconnect.org;
include /etc/nginx/params/gzip_on;
location / {
include /etc/nginx/params/proxy_pass_local_rareconnect_org_8000;
}
}
这是在官方docker注册表中显示的nginx:1.9.5的标准配置之上。
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/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 /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
提前致谢。
答案 0 :(得分:0)
看起来记录很少access_log
。你也可以查看nginx.conf
吗?