6 messages in ru.sysoev.nginxRe: expires off not applying
FromSent OnAttachments
Erik KarulfApr 16, 2007 7:20 pm 
Erik KarulfApr 19, 2007 10:50 pm 
Igor SysoevApr 20, 2007 12:01 am 
Erik KarulfApr 20, 2007 12:31 am 
Erik KarulfApr 20, 2007 12:36 am 
Igor SysoevApr 20, 2007 2:28 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: expires off not applyingActions...
From:Erik Karulf (erik@public.gmane.org)
Date:Apr 19, 2007 10:50:51 pm
List:ru.sysoev.nginx

After looking at the documentation some more, I can not figure out why this line is failing $request_filename !~* "^.+.(php|php3)$" The index option is set to use index.php, and $request_filename should be ending in .php, yet it still falls through the conditional and sets the expiration headers.

Any insight?

-Erik

Hello All! I am relatively new nginx user (~ 3 months), a convert from the lighttpd camp. I have been very happy with the elegance and power behind nginx and I am in the process of converting all of the servers in our cluster to nginx/apache/mongrel (from lighttpd and scgi)

Anyway, here is my problem. The environment is FreeBSD 6.2 running on AMD 64 I have nginx 0.5.11 setup to forward PHP requests to apache 1.3 (bound to 127.0.0.1:8080) while serving static files locally using sendfile(2)

Nginx seems to be modifying the expiration and cache control headers when I go to /, yet eerily enough it leaves them alone if you go to /index.php. Here are the associated http response headers:

For / Server nginx/0.5.11 Date Mon, 16 Apr 2007 13:04:12 GMT Content-Type text/html; charset=ISO-8859-1 Transfer-Encoding chunked Connection keep-alive X-Powered-By PHP/5.2.1 Expires Wed, 16 May 2007 13:04:12 GMT Cache-Control max-age=2592000 Pragma no-cache Content-Encoding gzip

For /index.php Server nginx/0.5.11 Date Mon, 16 Apr 2007 13:05:14 GMT Content-Type text/html; charset=ISO-8859-1 Transfer-Encoding chunked Connection keep-alive X-Powered-By PHP/5.2.1 Expires 0 Cache-Control private, post-check=0, pre-check=0, max-age=0 Pragma no-cache Content-Encoding gzip

I have attached my nginx.conf below. Also if you have any optimization recommendations, please let me know. Thanks for the help!

-Erik Karulf

nginx.conf>>EOF user www; worker_processes 1; #pid logs/nginx.pid;

events { worker_connections 8192; use kqueue; }

http { include mime.types; default_type application/octet-stream; access_log off; error_log off; sendfile on; tcp_nopush on; tcp_nodelay on;

keepalive_timeout 65; server_names_hash_bucket_size 128; # this seems to be required for vhosts

gzip on; gzip_min_length 1100; gzip_buffers 4 8k; gzip_http_version 1.0; gzip_comp_level 2; gzip_proxied any; gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;

proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; client_max_body_size 10m; client_body_buffer_size 128k; proxy_connect_timeout 90; proxy_send_timeout 90; proxy_read_timeout 90; proxy_buffer_size 4k; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; proxy_temp_file_write_size 64k;

# http://forums.example.com server { listen 80; server_name forums.example.com;

location / { root /www/forums.example.com/; index index.html index.htm index.php;

if ($request_filename !~* "^.+.(php|php3)$") { root /www/forums.example.com/; expires 30d; break; } expires off; proxy_pass http://127.0.0.1:8080/; }

location = /clear.gif { empty_gif; expires 30d; } } } EOF