Forum: NGINX 答复: static images 404 on Windows

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
kevin (Guest)
on 2009-05-12 13:46
(Received via mailing list)
Hi 坏人(Bad guy),
I had translated you mail. Hope it'll help you.

Please send all you configuration detail to me.
Including the webroot directory, static files and directory structure,
and try to introduce your fastcgi solution.

Hereby my configuration file, based on centos+nginx+apache+php
  server {
    listen       80;
    index index.htm index.php;
    root /data/sites;

    location ~* ^.+\.(jpg|jpeg|gif|png|js|css|swf)$ {
      valid_referers none blocked server_names *;
      if ($invalid_referer) {
        return   403;
      expires 1d;
      add_header  X-Cache   HIT;
      root         /static/abc;

    location / {
      proxy_redirect  off;
      proxy_set_header  isme    "huairen";
      proxy_set_header  Host    $host;
      proxy_set_header  X-Real-IP    $remote_addr;

You can the root directory could be same policy, it’s easy to
manipulate, you can try using "try_files" method also.

Keep the static file policy first, the dynamic request policy below. I
suggest using the "X-real-IP" parameter instead of "x-forward-to".
Because the "X-forward-to" is easily to fake.

I'm used to append  "x-cache" header to the response in order to mark
this request was hit in cache , you can do it in your way. Delete this
line will not cause any subsequences.

I am not using fastcgi solution, you can change it in your way, that

(The configuration I provided is a section from my own site. Based on
nginx + perl. I have modified quite a lot of core source of nginx,
please forgive me that I can't publish all details of my configuration
for security concern)

btw:you should learn more foreign languages. for better use of nginx, i
even had self-russian

Posted at Nginx Forum:,1888,1945#msg-1945

This topic is locked and can not be replied to.