Abstract behavior of nginx
Pomorski Jarosław
JPomorski at wolterskluwer.pl
Fri Nov 22 13:47:23 UTC 2013
Hi,
I can't understand behavior of nginx.
Version 1.2.1 on Debian Wheezy from official repository. I send requests to cdn.some_domain.pl server, and in log /var/log/nginx/cdn.some_domain.pl/test.log I see:
image/gif:1
image/png:1
image/png:1
image/gif:1
image/png:1
image/gif:1
It is correct. If I remove hash sign in 3 last line of configuration file, nginx puts to /var/log/nginx/cdn.some_domain.pl/test.log below entries:
-:0
-:0
-:0
-:0
-:0
-:0
I don't understand, why in this configuration, value of $sent_http_content_type variable is empty.
Configuration:
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
map $sent_http_content_type $cdn {
default 0;
text/css 1;
text/javascript 1;
image/x-icon 1;
image/gif 1;
image/jpeg 1;
image/png 1;
}
log_format test $sent_http_content_type:$cdn;
server {
listen 82 default; ## listen for ipv4
listen [::]:82 default ipv6only=on; ## listen for ipv6
server_name localhost "";
access_log /var/log/nginx/localhost.access.log;
error_log /var/log/nginx/localhost.error.log;
location / {
root /var/www;
index index.html index.htm;
}
location /test.txt {
proxy_pass http://$server_addr:8080;
}
}
server {
listen 82;
server_name cdn.some_domain.pl;
location / {
proxy_pass http://$server_addr:8080;
}
location /test.jsp {
proxy_pass http://$server_addr:8080;
allow 10.0.0.0/8;
deny all;
}
access_log /var/log/nginx/cdn.some_domain.pl/test.log test;
# if ($cdn) {
# return 404;
# }
}
}
Regards,
Jarek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20131122/228260cd/attachment.html>
More information about the nginx
mailing list