Forum: NGINX Problem configuring nginx

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F7ec36678a4102de7a6895d299a60819?d=identicon&s=25 Ian Hobson (Guest)
on 2009-01-19 14:45
(Received via mailing list)
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>
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2009-01-19 15:13
(Received via mailing list)
On Mon, Jan 19, 2009 at 01:39:58PM +0000, Ian Hobson 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;
F7ec36678a4102de7a6895d299a60819?d=identicon&s=25 Ian Hobson (Guest)
on 2009-01-19 23:46
(Received via mailing list)
Igor Sysoev 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
F7ec36678a4102de7a6895d299a60819?d=identicon&s=25 Ian Hobson (Guest)
on 2009-01-19 23:46
(Received via mailing list)
Igor Sysoev 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
F7ec36678a4102de7a6895d299a60819?d=identicon&s=25 Ian Hobson (Guest)
on 2009-01-19 23:46
(Received via mailing list)
Igor Sysoev 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
This topic is locked and can not be replied to.