* Roberto De Ioris <[email protected]> [2013-02-28 09:26]:
>> * Roberto De Ioris 
>> <[email protected]> [2013-02-28
>> 08:24]:
>>>> is it possible to make index files work with multiple plugins,
>>>> that is e.g. to allow both /foo/index.cgi and /bar/index.php as
>>>> index files when using the CGI and PHP plugins? The problem is
>>>> that using CGI and PHP in parallel seems to require routing based
>>>> on filename extensions which obviously doesn't work in case of
>>>> index files and routing currently doesn't have dynamic file
>>>> checks.
>>>
>>>
>>> This is what i use in my company to give hosting of cgi and php in the
>>> same instance (i think the mail client
>>> will cut some line, so pay attention to the content):
>>>
>>> for = index.xhtml index.html index.htm index.rhtml index.pl index.rb
>>> index.py index.cgi index.hs index.php index.php4 index.php5 index.sh
>>> index.php3 index.tcl index.shtml
>>>   static-index = %(_)
>>> endfor =
>>>
>>> for = .cgi .pl .py .rb .cgi .hs .php .php4 .php5 .sh .php3 .tcl .shtml
>>> .so
>>>   static-skip-ext = %(_)
>>> endfor =
>>>
>>> for = .cgi .pl .py .rb .hs
>>>   route = \%(_)$ uwsgi:,9,0
>>> endfor =
>>>
>>> for = .php .php3 .php4 .php5 .inc
>>>   php-allowed-ext = %(_)
>>>   php-index = index%(_)
>>>   route = \%(_)$ uwsgi:,14,0
>>> endfor =
>>>
>>>
>>> basically i instruct uWSGI to force the rewrite of the path_info to
>>> index.something, but then i skip that extension, so it will be passed to
>>> the corresponding plugin.
>>>
>>> finally i set routing based on file extension (php-index is required for
>>> security reasons, it will work even without that)
>>
>> I'm struggeling to create a minimal working configuration on
>> that, what do use as the default (0) modifier for the above?
>>
>
> the 'notfound' plugin:
>
> plugins = router_uwsgi,0:notfound,cgi,php540
>
> i know, it is a bit 'raw', but honestly it is the fastest way to
> accomplish a customer-need setup.

Hmm, I still can't get it to work, I've created the following minimal config
based on that:

----

[uwsgi]
plugins = 0:notfound,cgi,php,router_uwsgi

http-socket = :8080

docroot = /home/gber/public_html/

check-static = %(docroot)

cgi = %(docroot)

for = index.xhtml index.html index.htm index.rhtml index.pl index.rb index.py 
index.cgi index.hs index.php index.php4 index.php5 index.sh index.php3 
index.tcl index.shtml
  static-index = %(_)
endfor =

for = .cgi .pl .py .rb .cgi .hs .php .php4 .php5 .sh .php3 .tcl .shtml .so
  static-skip-ext = %(_)
endfor =

for = .cgi .pl .py .rb .hs
  route = \%(_)$ uwsgi:,9,0
endfor =

for = .php .php3 .php4 .php5 .inc
  php-allowed-ext = %(_)
  php-index = index%(_)
  route = \%(_)$ uwsgi:,14,0
endfor =

----

I have the following docroot:

----

$ find /home/gber/public_html -print
/home/gber/public_html
/home/gber/public_html/foo/
/home/gber/public_html/foo/index.pl
/home/gber/public_html/bar/
/home/gber/public_html/bar/index.php
/home/gber/public_html/baz/
/home/gber/public_html/baz/index.html

Requesting the files explicitly works:

----

$ for p in foo/index.pl bar/index.php baz/index.html; do curl -I 
http://127.0.0.1:8080/${p}; done
HTTP/1.1 200 OK
Content-type: text/html

HTTP/1.1 200 OK
X-Powered-By: PHP/5.3.3
Content-type: text/html

HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 93
Last-Modified: Thu, 28 Feb 2013 09:45:53 GMT

----

But as index files they do not work:

----

$ for p in foo/ bar/ baz/; do curl -I http://127.0.0.1:8080/${p}; done
HTTP/1.1 404 Not Found
Connection: close
Content-Type: text/plain

HTTP/1.1 404 Not Found
Connection: close
Content-Type: text/plain

HTTP/1.1 404 Not Found
Connection: close
Content-Type: text/plain

----

This is with the latest git snapshot.
-- 
Guido Berhoerster
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to