windows static assets - solved

Chris Cortese cortese.consulting at gmail.com
Fri May 15 10:39:01 MSD 2009


Actually that does work.  Now I'm stumped as to what was the original 
problem because I'm pretty sure I had that at one point.  At least it's 
solved now.

Igor Sysoev wrote:
> On Thu, May 14, 2009 at 06:33:59PM -0700, Chris Cortese wrote:
>
>   
>> I finally found the solution to my problem with getting 404 on static 
>> assets (/images, /js, /css).
>>
>> Not sure how I missed it before but I saw the problem in the error log 
>> now.  Basically  I was not understanding that the root path needed to be 
>> relative to the location of the nginx.exe (c:\nginx\nginx.exe).
>>     
>
> Actually in nginx/Windows root is relative to the directory where nginx
> was run.
>
>   
>> Changing "/cygwin/..." to "../cygwin/..." was my solution.  I didn't 
>> have a problem with the non-static stuff (PHP) because all of that was 
>> handled by fastcgi, which expected the full windows path 
>> ("c:/cygwin/...").  Below is my working 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;  # this 
>>     
>
> Does not this work:
>
>   root C:/cygwin/home/Chris/www/live/jobsite/trunk/html/public;
>
> ?
>
>   
>> was the fix
>>  index index.php index.html;
>>
>> # serve static files directly
>>  location ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico|pdf|zip|tar|gz|bz|bz2)$ {
>>  }
>>
>>  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 ~ /.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;
>>  }
>> }
>>
>>     
>
>   






More information about the nginx mailing list