# Nginx-0.7.18

**URL:** <https://www.ruby-forum.com/t/nginx-0-7-18/150805>\
**Category:** NGINX\
**Created:** [October 13, 2008, 3:34pm UTC](https://www.ruby-forum.com/t/nginx-0-7-18/150805 "2008-10-13T15:34:28Z")\
**Posts on this page:** 8\
**Page:** 3

<div class="post-metadata">

**Author:** ![imixaly4](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/3ab097/32.png) [@imixaly4](https://www.ruby-forum.com/u/imixaly4)\
**Post date:** [October 21, 2008, 4:41pm UTC](https://www.ruby-forum.com/t/nginx-0-7-18/150805/41 "2008-10-21T16:41:02Z")

</div>

OK.Finally I get it.  
Put “rewrite ^ /dll/$secure\_link break;” to the secure\_link block;  
But I have a question:  
The hash must be md5(link/file,secret).  
When the file changes,the hash should also change.  
Can nginx make the hash to md5(link,secret)?then only the directory  
name is the key to hash,not include the name of files under the  
directory.  
For example:  
In my example,when access /dll/dl/,use the hash md5(dl,secret),not  
md5(dl/file,secret).

2008/10/21 Igor S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![imixaly4](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/3ab097/32.png) [@imixaly4](https://www.ruby-forum.com/u/imixaly4)\
**Post date:** [October 21, 2008, 4:33pm UTC](https://www.ruby-forum.com/t/nginx-0-7-18/150805/42 "2008-10-21T16:33:22Z")

</div>

On Tue, Oct 21, 2008 at 10:19:37PM +0800, lhmwzy wrote:

> But it should display the content of index.html,not a 404 page.  
> So we should use a hash like md5(link/file, secret),not md5(link, secret)?

The secure link is

/prefix/hash/any/thing/here

hash = md5(any/thing/heresecret)

---

<div class="post-metadata">

**Author:** ![imixaly4](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/3ab097/32.png) [@imixaly4](https://www.ruby-forum.com/u/imixaly4)\
**Post date:** [October 21, 2008, 4:45pm UTC](https://www.ruby-forum.com/t/nginx-0-7-18/150805/43 "2008-10-21T16:45:09Z")

</div>

or can add a directive to do this.  
Only a suggestion.

2008/10/21 lhmwzy [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![imixaly4](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/3ab097/32.png) [@imixaly4](https://www.ruby-forum.com/u/imixaly4)\
**Post date:** [November 10, 2008, 4:06pm UTC](https://www.ruby-forum.com/t/nginx-0-7-18/150805/44 "2008-11-10T16:06:30Z")

</div>

> \*) Feature: the ngx\_http\_secure\_link\_module.

Is it possible to proxy the request?

## I’d like to do something like this:

location /dl/  
secure\_link\_secret lhm;  
if ($secure\_link = “”) {  
return 403;  
}  
}

```
proxy_pass http://192.168.0.10:3000;

rewrite ^ $secure_link break;

```

---

<div class="post-metadata">

**Author:** ![imixaly4](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/3ab097/32.png) [@imixaly4](https://www.ruby-forum.com/u/imixaly4)\
**Post date:** [November 10, 2008, 6:16pm UTC](https://www.ruby-forum.com/t/nginx-0-7-18/150805/45 "2008-11-10T18:16:55Z")

</div>

On Mon, Nov 10, 2008 at 03:59:31PM +0100, Thomas wrote:

> ```
> }
> }
> 
> proxy_pass http://192.168.0.10:3000;
> 
> rewrite ^ $secure_link break;
> 
> ```
> 
> –

Yes, you may use something like this:

```
 proxy_pass http://192.168.0.10:3000/$secure_link;

```

---

<div class="post-metadata">

**Author:** ![imixaly4](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/3ab097/32.png) [@imixaly4](https://www.ruby-forum.com/u/imixaly4)\
**Post date:** [November 11, 2008, 7:16pm UTC](https://www.ruby-forum.com/t/nginx-0-7-18/150805/46 "2008-11-11T19:16:32Z")

</div>

I tried to play with

## but when I launch nginx I get the following error message:

## [emerg] 27797#0: unknown directive “secure\_link\_secret” in /usr/local/nginx/conf/website.conf

## Here is my configuration file excerpt:

location /secret/ {  
secure\_link\_secret some\_secret;

```
if ($secure_link = "") {
  return 403;
}

rewrite ^ /$secure_link break;
proxy_pass http://website/$secure_link;

```

## }

## Here is my configure:

## ./configure --with-http\_ssl\_module --with-http\_gzip\_static\_module –with-http\_secure\_link\_module --with-poll\_module –with-pcre=…/pcre-7.8 --with-http\_flv\_module –sbin-path=/usr/sbin/nginx --prefix=/usr/local/nginx –add-module=…/nginx\_mp4\_streaming\_lite --with-cc-opt=’-O3’

## Moreover I don’t understand the following:

1. hash is md5(link, secret),  
the secret is set by secure\_link\_secret directive;  
–  
What is this secret thing? md5 cannot be decoded, so does this mean  
that I have to hard code all my secret links inside Nginx’  
configuration file?

---

<div class="post-metadata">

**Author:** ![imixaly4](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/3ab097/32.png) [@imixaly4](https://www.ruby-forum.com/u/imixaly4)\
**Post date:** [October 21, 2008, 5:04pm UTC](https://www.ruby-forum.com/t/nginx-0-7-18/150805/47 "2008-10-21T17:04:02Z")

</div>

On Tue, Oct 21, 2008 at 10:34:55PM +0800, lhmwzy wrote:

> md5(dl/file,secret).  
> No, the sense is to protect awhole link.

---

<div class="post-metadata">

**Author:** ![imixaly4](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/3ab097/32.png) [@imixaly4](https://www.ruby-forum.com/u/imixaly4)\
**Post date:** [November 11, 2008, 7:48pm UTC](https://www.ruby-forum.com/t/nginx-0-7-18/150805/48 "2008-11-11T19:48:47Z")

</div>

Damn’ it! I’m having troubles with my $path or what? Istarted nginx by  
specifying the full paht, i.e: /usr/sbin/nginx, and now the correct  
nginx started with the module compiled and I didn’t have any error  
messages.

I now have to understand how the secure\_link\_module works.

[Previous page](https://www.ruby-forum.com/t/nginx-0-7-18/150805.md?page=2)
