# Problem configuring nginx

**URL:** <https://www.ruby-forum.com/t/problem-configuring-nginx/158116>\
**Category:** NGINX\
**Created:** [January 19, 2009, 2:45pm UTC](https://www.ruby-forum.com/t/problem-configuring-nginx/158116 "2009-01-19T14:45:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dcian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/91b2a8/32.png) [@dcian](https://www.ruby-forum.com/u/dcian)\
**Post date:** [January 19, 2009, 2:45pm UTC](https://www.ruby-forum.com/t/problem-configuring-nginx/158116/1 "2009-01-19T14:45:52Z")

</div>

Hi,

I wish to convert a url of the form: “[http://mydomain/path/file.htm](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

---

<div class="post-metadata">

**Author:** ![dcian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/91b2a8/32.png) [@dcian](https://www.ruby-forum.com/u/dcian)\
**Post date:** [January 19, 2009, 3:13pm UTC](https://www.ruby-forum.com/t/problem-configuring-nginx/158116/2 "2009-01-19T15:13:01Z")

</div>

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;

```

---

<div class="post-metadata">

**Author:** ![dcian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/91b2a8/32.png) [@dcian](https://www.ruby-forum.com/u/dcian)\
**Post date:** [January 19, 2009, 11:46pm UTC](https://www.ruby-forum.com/t/problem-configuring-nginx/158116/3 "2009-01-19T23:46:16Z")

</div>

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. 🙂

Regards

Ian

---

<div class="post-metadata">

**Author:** ![dcian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/91b2a8/32.png) [@dcian](https://www.ruby-forum.com/u/dcian)\
**Post date:** [January 19, 2009, 11:46pm UTC](https://www.ruby-forum.com/t/problem-configuring-nginx/158116/4 "2009-01-19T23:46:17Z")

</div>

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. 🙂

Regards

Ian

---

<div class="post-metadata">

**Author:** ![dcian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/91b2a8/32.png) [@dcian](https://www.ruby-forum.com/u/dcian)\
**Post date:** [January 19, 2009, 11:46pm UTC](https://www.ruby-forum.com/t/problem-configuring-nginx/158116/5 "2009-01-19T23:46:54Z")

</div>

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. 🙂

Regards

Ian
