# Expires max question

**URL:** <https://www.ruby-forum.com/t/expires-max-question/215296>\
**Category:** NGINX\
**Created:** [December 29, 2011, 5:07pm UTC](https://www.ruby-forum.com/t/expires-max-question/215296 "2011-12-29T17:07:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [December 29, 2011, 5:07pm UTC](https://www.ruby-forum.com/t/expires-max-question/215296/1 "2011-12-29T17:07:30Z")

</div>

We’re running Moodle which uses this format to load images:

/file.php/dirname/file.gif

Using the map directives and modification of fastcgi parameters and  
location tag I was able to get the above format working.

I would now like to associate the “expires max” option with any media  
files  
such as swf, gif, jpg, etc. but this type of location tag (rightfully  
so)  
interferes with the php location tag (normally it wouldn’t as I’d  
strictly  
be dealing with .php$). These are the 2 location tags I’m trying to  
combine or make work together, does anyone have any suggestions?

```
# This location tag interferes with the PHP location tag (for calls

```

such as file.php/dir/file.jpg)  
#location ~\* .(js|css|png|jpg|jpeg|gif|ico|flv|swf)$ {  
# expires max;  
# log\_not\_found off;  
#}

```
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ ^(?<SCRIPT_FILENAME>.+\.php)(?<PATH_INFO>.*)$ {
    include fastcgi_params;
    fastcgi_index index.php;
    fastcgi_pass 127.0.0.1:9000;
}
```
