Problem configuring nginx

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

On Mon, Jan 19, 2009 at 01:39:58PM +0000, Ian H. wrote:

/home/ian/websites/builder/parser.php?f=$fastcgi_script_name;

  •  rewrite ^(.*\.htm)$ /builder/parser.php?f=$1;
    
  •  fastcgi_param SCRIPT_FILENAME 
    

/home/ian/websites/builder/parser.php?f=$fastcgi_script_name;

  •  fastcgi_pass 127.0.0.9000;
    
  •  fastcgi_param SCRIPT_FILENAME 
    

/home/ian/websites/builder/parser.php;

  •  fastcgi_param QUERY_STRING     f=$uri;
    
  •  fastcgi_param DOCUMENT_ROOT    $document_root;

Igor S. wrote:

/home/ian/websites/builder/parser.php?f=$fastcgi_script_name;

  •  rewrite ^(.*\.htm)$ /builder/parser.php?f=$1;  
    
  •  fastcgi_param SCRIPT_FILENAME  /home/ian/websites/builder/parser.php?f=$fastcgi_script_name;
    
  •  fastcgi_pass 127.0.0.9000; 
    
  •  fastcgi_param SCRIPT_FILENAME  /home/ian/websites/builder/parser.php;
    
  •  fastcgi_param QUERY_STRING     f=$uri;
    

Correction
fastcgi_param QUERY_STRING f=$request_uri;

  •  fastcgi_param DOCUMENT_ROOT    $document_root;
    

Thanks Igor,

The site is now working. :slight_smile:

Regards

Ian

Igor S. wrote:

/home/ian/websites/builder/parser.php?f=$fastcgi_script_name;

  •  rewrite ^(.*\.htm)$ /builder/parser.php?f=$1;  
    
  •  fastcgi_param SCRIPT_FILENAME  /home/ian/websites/builder/parser.php?f=$fastcgi_script_name;
    
  •  fastcgi_pass 127.0.0.9000; 
    
  •  fastcgi_param SCRIPT_FILENAME  /home/ian/websites/builder/parser.php;
    
  •  fastcgi_param QUERY_STRING     f=$uri;
    

Correction
fastcgi_param QUERY_STRING f=$request_uri;

  •  fastcgi_param DOCUMENT_ROOT    $document_root;
    

Thanks Igor,

The site is now working. :slight_smile:

Regards

Ian

Igor S. wrote:

/home/ian/websites/builder/parser.php?f=$fastcgi_script_name;

  •  rewrite ^(.*\.htm)$ /builder/parser.php?f=$1;  
    
  •  fastcgi_param SCRIPT_FILENAME  /home/ian/websites/builder/parser.php?f=$fastcgi_script_name;
    
  •  fastcgi_pass 127.0.0.9000; 
    
  •  fastcgi_param SCRIPT_FILENAME  /home/ian/websites/builder/parser.php;
    
  •  fastcgi_param QUERY_STRING     f=$uri;
    

Correction
fastcgi_param QUERY_STRING f=$request_uri;

  •  fastcgi_param DOCUMENT_ROOT    $document_root;
    

Thanks Igor,

The site is now working. :slight_smile:

Regards

Ian