Ç­”复: static images 404 on Windows


#1

Hi 坏人(Bad guy),
I had translated you mail. Hope it’ll help you.

éº»çƒ¦æŠŠä½ çš„å„ç§ä¿¡æ¯å‘å‡ºæ¥
Please send all you configuration detail to me.
包括主目录、各种静态文件的目录结构、以及说明下fastcgi实现的方式。
Including the webroot directory, static files and directory structure,
and try to introduce your fastcgi solution.

我的部分配置。基于centos+nginx+apache+php
Hereby my configuration file, based on centos+nginx+apache+php
server {
listen 80;
server_name www.abc.com;
index index.htm index.php;
root /data/sites;

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


location / {
  proxy_pass  http://127.0.0.1:81;
  proxy_redirect  off;
  proxy_set_header  isme    "huairen";
  proxy_set_header  Host    $host;
  proxy_set_header  X-Real-IP    $remote_addr;
}

主目录和静态文件可以相同可以不同,diy很强。还可以用try_files的方式
You can the root directory could be same policy, it’s easy to
manipulate, you can try using “try_files” method also.

静态在上面,动态在下面。推荐用X-Real-IP,否则ipå°±æœ‰è¢«äººä¸ºä¼ªé€ çš„å¯èƒ½
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.

X-Cacheæ˜¯æˆ‘çš„ä¹ æƒ¯ï¼Œä½ å¯ä»¥å¿½ç•¥ã€‚åˆ æŽ‰å¯ä»¥å‡å°‘å‡ å­—èŠ‚ï¼Œå“ˆå“ˆ
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.

我没用fastcgiï¼Œä½ ç›¸åº”çš„æ”¹ä¸‹å°±è¡Œ
I am not using fastcgi solution, you can change it in your way, that
fine.

(以上部分配置是从我的一个站点中截取出来的,基于nginx+perlã€‚å› å†…æ ¸æ”¹äº†å¾ˆå¤šï¼Œæ‰€ä»¥ä¸å¯èƒ½å…¨å‘å‡ºæ¥ï¼Œè§è°…ï¼‰
(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:
http://forum.nginx.org/read.php?2,1888,1945#msg-1945

BD,
Kevin