Problem configuring nginx

Ian Hobson ian at ianhobson.co.uk
Mon Jan 19 16:39:58 MSK 2009


Hi,

I wish to convert a url of the form: "http://mydomain/path/file.htm" 

to  run script   /home/ian/websites/builder/parser.php?f=/path/file.htm 
   
with root of  /home/ian/websites/emccatering (so the script can find 
path/file.,htm) 

Builder is a service script that is outside the document root and usable 
by any hosted domain. It converts pages defined in markdown into proper 
web pages.

So far I have tried all sorts and failed to achieve what I want. The 
file linked to site-available contains...

server {
   listen 80;
   server_name emc.titan.hcs;                       # testing only
   root /home/ianwebsites/emccatering           # where .htm files are
   location ~ \.htm$ {                                   # source files
      rewrite ^(.*\.htm)$ /builder/parser.php?f=$1;  
      fastcgi_param SCRIPT_FILENAME 
/home/ian/websites/builder/parser.php?f=$fastcgi_script_name;
   }
   location ~ \.php {
        fastcgi_pass 127.0.0.9000; 
   }
}

This does serve .static files properly, but .htm files produce "No input 
file specified.".

There is a "fastcgi_param SCRIPT_FILENAME   
$document_root$fastcgi_script_name; " in an include file in nginx.conf. 
If this is present php files are handled properly, and show the correct 
value of $_SERVER['DOCUMENT_ROOT']

How can I achieve what I need?

Regards

Ian

Note -
The above has been carefully typed from another machine, but typos may 
have crept in.

Setting this up with Apache involved the Alias directive and was:-

Action   application/x-httpd-builder  "/builder/parser.php?f="
Alias /builder D:/Websites/builder

<virtualHost *:80>
  ServerName emc.mars.hcs
  DocumentRoot "D:/Websites/emccatering"
  AddType  application/x-httpd-builder .htm 
</VirtualHost>
 

  

 
 





More information about the nginx mailing list