Static images 404 on Windows


#1

OK so I’ve tried everything I can think of on this one.

Running 0.7.55 on both Ubuntu Jaunty and XP. Jaunty works just fine.
On the Jaunty config, I do use rewrite to remap my js and css, but my
location /images/ directive is identical on Jaunty and XP, and the
latter 404’s.

On XP, I can’t get any of my static assets (/images, /css, /js) to load,
all 404. /css/style.php (see conf below) works fine as does all .php
code. This is a codeigniter site which explains the handling of
index.php.

Note that I have web source under /cygwin for my convenience only but I
am not using any cygwin components in my stack, all native Windows
components.

Here’s my latest version of the XP config:

server {
listen *:80;
server_name jobsite.xpdesktop;

access_log logs/jobsite.access.log;
error_log logs/jobsite.error.log;

root /cygwin/home/Chris/www/live/jobsite/trunk/html/public;
index index.php index.html;

location / {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME
c:/cygwin/home/Chris/www/live/jobsite/trunk/html/public/index.php;
fastcgi_param QUERY_STRING q=$request_uri;
include fastcgi_params;
}

location ~ (jpg|jpeg|gif|png)$ {
}

location /images/ {
expires 30d;
}

location ~ /.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
c:/cygwin/home/Chris/www/live/jobsite/trunk/html/public$fastcgi_script_name;
fastcgi_param QUERY_STRING q=$request_uri;
include fastcgi_params;
}

location = /css/style.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME
c:/cygwin/home/Chris/www/live/jobsite/trunk/html/public/css/style.php;
include fastcgi_params;
}
}


#2

Note that I have web source under /cygwin for my convenience only but I am
not using any cygwin components in my stack, all native Windows components.

 root /cygwin/home/Chris/www/live/jobsite/trunk/html/public;
 index index.php index.html;

Since you are not using cygwin, I don’t think
/cygwin/home/Chris/www/live/jobsite/trunk/html/public is a valid path
on windows, maybe you should change it to c:/cygwin… ?


#3

thanks, I thought about that but the root path is working fine for the
.php … just not the /public/css, /public/images, /public/js …


#4

thanks…

it seems for me I just cannot trigger anything in that block.

Anybody see anything wrong?

Can there be a good way to debug which location directive is
processing??

location ~ (jpg|jpeg|gif|png)$ {
root c:/cygwin/home/Chris/www/live/jobsite/trunk/html/public;
#anything – never gets here
}


#5

On Mon, May 11, 2009 at 09:36:22PM -0700, Chris Cortese wrote:

thanks, I thought about that but the root path is working fine for the
.php … just not the /public/css, /public/images, /public/js …

location ~ (jpg|jpeg|gif|png)$ {
root c:/cygwin/home/Chris/www/live/jobsite/trunk/html/public;
}

If php is cygwin application it requires cygwin style paths
“/cygwin/…”,
Native applications require usual win32 paths: “c:/cygwin/…”.


#6

On Tue, May 12, 2009 at 12:16:25AM -0700, Chris Cortese wrote:

#anything – never gets here
}

Only debug log:

./configure --with-debug …
error_log /path/to/log debug;

You will see

test location …
test location …
test location …
using location …


#7

thank you for replying. I was starting to wonder if the email went
through.

Unfortunately, I cannot read it. Can anybody translate for me? Thanks
again.

Chris


#8

第一次见问题这么多的配置
location / {è¿™ä¸ªæ”¾é‚£ä¹ˆé ä¸Šçš„ä½ç½®ï¼ŒåŽé¢çš„location怎么用?
另外静态的图片不推荐用location ~ (jpg|jpeg|gif|png)$ {这种方式

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,1888,1919#msg-1919


#9

é™æ€æ–‡ä»¶çš„é…ç½®åœ¨ä¸Šï¼ŒåŠ¨æ€çš„åœ¨ä¸‹ã€‚å¦‚æžœå¼„åäº†ï¼Œé™æ€é…ç½®æ ¹æœ¬ä¸ç”Ÿæ•ˆ

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,1888,1924#msg-1924


#10

raptium wrote:

Trans: location / is on the top, so how can the following locations be used?

另外静态的图片不推荐用location ~ (jpg|jpeg|gif|png)$ {这种方式

Trans: I don’t recommend to use location ~ (jpg… $ for serving static images.

ok thanks. What is the best way though? I cannot get static assets on
the Windows side (necessary for me to see what the Windows world looks
like).


#11

2009/5/12 “坏人” removed_email_address@domain.invalid:

第一次见问题这么多的配置
Trans: First time to see a config with some many problems…

location / {è¿™ä¸ªæ”¾é‚£ä¹ˆé ä¸Šçš„ä½ç½®ï¼ŒåŽé¢çš„location怎么用?
Trans: location / is on the top, so how can the following locations be
used?

另外静态的图片不推荐用location ~ (jpg|jpeg|gif|png)$ {这种方式
Trans: I don’t recommend to use location ~ (jpg… $ for serving static
images.


#12

éº»çƒ¦æŠŠä½ çš„å„ç§ä¿¡æ¯å‘å‡ºæ¥
包括主目录、各种静态文件的目录结构、以及说明下fastcgi实现的方式。

我的部分配置。基于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的方式
静态在上面,动态在下面。推荐用X-Real-IP,否则ipå°±æœ‰è¢«äººä¸ºä¼ªé€ çš„å¯èƒ½
X-Cacheæ˜¯æˆ‘çš„ä¹ æƒ¯ï¼Œä½ å¯ä»¥å¿½ç•¥ã€‚åˆ æŽ‰å¯ä»¥å‡å°‘å‡ å­—èŠ‚ï¼Œå“ˆå“ˆ
我没用fastcgiï¼Œä½ ç›¸åº”çš„æ”¹ä¸‹å°±è¡Œ
(以上部分配置是从我的一个站点中截取出来的,基于nginx+perlã€‚å› å†…æ ¸æ”¹äº†å¾ˆå¤šï¼Œæ‰€ä»¥ä¸å¯èƒ½å…¨å‘å‡ºæ¥ï¼Œè§è°…ï¼‰

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


#13

On Tue, May 12, 2009 at 03:56:32AM -0400, ??? wrote:

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

Learing foreign languages is certainyl good thing.
However, if you believe that anyone may translate your responses via
translate.google.com, you made mistake: its translation quality is poor.


#14

On Thu, May 14, 2009 at 02:58:44PM -0700, Chris Cortese wrote:

Hi,

Problem is I’m only having the problem on Windows–where I’m using the
prebuilt Windows binary.

Is there any way to get a current Windows binary that is built with
debug on?

Sorry, I’ve missed that we talking about nginx/Windows.
It’s already built --with-debug.


#15

Hi,

Problem is I’m only having the problem on Windows–where I’m using the
prebuilt Windows binary.

Is there any way to get a current Windows binary that is built with
debug on?

Thanks,
Chris