Problem with serving static files on seaside 3.0 and lighttpd

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with serving static files on seaside 3.0 and lighttpd

Mark Ross-5
Hi all!
I tried hard in the last days to serve static files for my seaside application, but had no success.

I want to leave static files on the server (/var/www/resources/css/*; js/*; images/*) and access them from within my seaside application e.g. by

anHtmlRoot javascript url: '/resources/js/flotr.js'.
 
This works for me, until upgrading to Seaside 3.

My configuration:

GemStone/S 64 3.0.0, fastCGI, lighttpd, Debian stable 64 bit.

GemStone/S, Seaside, fastCGI and lighttpd are running perfect, but I can´t access static files (/var/www/resources) from within Seaside (e.g.: /resources/css/screen.css not found ).

I have to configure seaside to handle the resources directory to access the static files - but I have no idea how.

FastCGI is handling all the requests up from '/'

My lightttpd config(part for fastcgi) - Thanks to Miguel Cobá (http://miguel.leugim.com.mx/index.php/2008/09/27/gemstones-and-fastcgi-with-lighttpd/):

# forward the request to the fastcgi hosts
fastcgi.server = ( "/" => (
    ( "host" => "127.0.0.1", "port" => 9001, "check-local" => "disable"),
    ( "host" => "127.0.0.1", "port" => 9002, "check-local" => "disable"),
    ( "host" => "127.0.0.1", "port" => 9003, "check-local" => "disable")
  )
)
# enabling server dir listing to prove if lighttpd is serving the files - ok
server.dir-listing          = "enable"

-> When I switch off fastcgi server I can lighttpd is serving the files.

I tried to add:
* a new Seaside Dispatcher: 'resources' with server path '/var/www/resources'
* configuration in lighttpd:
        alias.url += ( "/resources/" => "/var/www/resources" )
* url.rewrite-once = (
                "^(/resources.*)$" => "$1",
                "^(/.*)$" => "/$1"
        )
* I read the seaside docs, the web and book.seaside.st (which covers static file serving, but with apache)


I think it is no difficult setting.

Anybody out to help?


Best regards


Mark



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Problem with serving static files on seaside 3.0 and lighttpd

Johan Brichau-2
Mark,

Did you use the same lighttpd configuration in seaside2.8 ?

It seems to me that the fastcgi entry is always consuming all requests, hence your static file serving works only when you turn the fastcgi entry off.
Try only redirecting to the

fastcgi.server = ( "/myapp" => (

Maybe there are ways to define a different selection order for requests that match multiple url match blocks, but I have only limited experience using lighttpd.
A solution can be to set the fastcgi match block last?

Johan

On 07 Aug 2011, at 14:46, Mark Ross wrote:

> Hi all!
> I tried hard in the last days to serve static files for my seaside application, but had no success.
>
> I want to leave static files on the server (/var/www/resources/css/*; js/*; images/*) and access them from within my seaside application e.g. by
>
> anHtmlRoot javascript url: '/resources/js/flotr.js'.

That looks correct.
Just a small remark is that you might want consider using #resourceUrl:
See more about that here: http://book.seaside.st/book/in-action/serving-files/images

>
> This works for me, until upgrading to Seaside 3.
>
> My configuration:
>
> GemStone/S 64 3.0.0, fastCGI, lighttpd, Debian stable 64 bit.
>
> GemStone/S, Seaside, fastCGI and lighttpd are running perfect, but I can´t access static files (/var/www/resources) from within Seaside (e.g.: /resources/css/screen.css not found ).
>
> I have to configure seaside to handle the resources directory to access the static files - but I have no idea how.
>
> FastCGI is handling all the requests up from '/'
>
> My lightttpd config(part for fastcgi) - Thanks to Miguel Cobá (http://miguel.leugim.com.mx/index.php/2008/09/27/gemstones-and-fastcgi-with-lighttpd/):
>
> # forward the request to the fastcgi hosts
> fastcgi.server = ( "/" => (
>    ( "host" => "127.0.0.1", "port" => 9001, "check-local" => "disable"),
>    ( "host" => "127.0.0.1", "port" => 9002, "check-local" => "disable"),
>    ( "host" => "127.0.0.1", "port" => 9003, "check-local" => "disable")
>  )
> )
> # enabling server dir listing to prove if lighttpd is serving the files - ok
> server.dir-listing          = "enable"
>
> -> When I switch off fastcgi server I can lighttpd is serving the files.
>
> I tried to add:
> * a new Seaside Dispatcher: 'resources' with server path '/var/www/resources'
> * configuration in lighttpd:
> alias.url += ( "/resources/" => "/var/www/resources" )
> * url.rewrite-once = (
>                 "^(/resources.*)$" => "$1",
>                 "^(/.*)$" => "/$1"
>         )
> * I read the seaside docs, the web and book.seaside.st (which covers static file serving, but with apache)
>
>
> I think it is no difficult setting.
>
> Anybody out to help?
>
>
> Best regards
>
>
> Mark
>
>
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Problem with serving static files on seaside 3.0 and lighttpd

Nick
In reply to this post by Mark Ross-5
Hi,

It's a while since I experimented with lighttpd; I believe the following worked for me:

$HTTP["url"] !~ "^/resources/" {
#  fastcgi.debug=1
 fastcgi.server = ("/" =>(
   ("host" => "127.0.0.1", "port" => 9001, "check-local" => "disable"),
   ("host" => "127.0.0.1", "port" => 9002, "check-local" => "disable"),
   ("host" => "127.0.0.1", "port" => 9003, "check-local" => "disable")
  )
 )
}

which would pass the request onto Gemstone unless the request began
with '^/resources/'
and add something similar to the below to your lighttpd configuration
server.document-root  = "/var/www/"
HTH

Nick


On 7 August 2011 13:46, Mark Ross <[hidden email]> wrote:
Hi all!
I tried hard in the last days to serve static files for my seaside application, but had no success.

I want to leave static files on the server (/var/www/resources/css/*; js/*; images/*) and access them from within my seaside application e.g. by

anHtmlRoot javascript url: '/resources/js/flotr.js'.

This works for me, until upgrading to Seaside 3.

My configuration:

GemStone/S 64 3.0.0, fastCGI, lighttpd, Debian stable 64 bit.

GemStone/S, Seaside, fastCGI and lighttpd are running perfect, but I can´t access static files (/var/www/resources) from within Seaside (e.g.: /resources/css/screen.css not found ).

I have to configure seaside to handle the resources directory to access the static files - but I have no idea how.

FastCGI is handling all the requests up from '/'

My lightttpd config(part for fastcgi) - Thanks to Miguel Cobá (http://miguel.leugim.com.mx/index.php/2008/09/27/gemstones-and-fastcgi-with-lighttpd/):

# forward the request to the fastcgi hosts
fastcgi.server = ( "/" => (
   ( "host" => "127.0.0.1", "port" => 9001, "check-local" => "disable"),
   ( "host" => "127.0.0.1", "port" => 9002, "check-local" => "disable"),
   ( "host" => "127.0.0.1", "port" => 9003, "check-local" => "disable")
 )
)
# enabling server dir listing to prove if lighttpd is serving the files - ok
server.dir-listing          = "enable"

-> When I switch off fastcgi server I can lighttpd is serving the files.

I tried to add:
* a new Seaside Dispatcher: 'resources' with server path '/var/www/resources'
* configuration in lighttpd:
       alias.url += ( "/resources/" => "/var/www/resources" )
* url.rewrite-once = (
                       "^(/resources.*)$" => "$1",
                       "^(/.*)$" => "/$1"
               )
* I read the seaside docs, the web and book.seaside.st (which covers static file serving, but with apache)


I think it is no difficult setting.

Anybody out to help?


Best regards


Mark



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Problem with serving static files on seaside 3.0 and lighttpd

Mark Ross-5
Hi Nick,
THANK you very much, as I mentioned the solution was simple -but I didn´t find it.

I added the line as you described, and my installation is working, as wanted.

I am very happy!

Best regards

Mark

Am 07.08.2011 um 15:33 schrieb Nick Ager:

> Hi,
>
> It's a while since I experimented with lighttpd; I believe the following worked for me:
>
> $HTTP["url"] !~ "^/resources/" {
> #  fastcgi.debug=1
>  fastcgi.server = ("/" =>(
>    ("host" => "127.0.0.1", "port" => 9001, "check-local" => "disable"),
>    ("host" => "127.0.0.1", "port" => 9002, "check-local" => "disable"),
>    ("host" => "127.0.0.1", "port" => 9003, "check-local" => "disable")
>   )
>  )
> }
>
> which would pass the request onto Gemstone unless the request began
> with '^/resources/'
> and add something similar to the below to your lighttpd configuration
> server.document-root  = "/var/www/"
> HTH
>
> Nick
>
>
> On 7 August 2011 13:46, Mark Ross <[hidden email]> wrote:
> Hi all!
> I tried hard in the last days to serve static files for my seaside application, but had no success.
>
> I want to leave static files on the server (/var/www/resources/css/*; js/*; images/*) and access them from within my seaside application e.g. by
>
> anHtmlRoot javascript url: '/resources/js/flotr.js'.
>
> This works for me, until upgrading to Seaside 3.
>
> My configuration:
>
> GemStone/S 64 3.0.0, fastCGI, lighttpd, Debian stable 64 bit.
>
> GemStone/S, Seaside, fastCGI and lighttpd are running perfect, but I can´t access static files (/var/www/resources) from within Seaside (e.g.: /resources/css/screen.css not found ).
>
> I have to configure seaside to handle the resources directory to access the static files - but I have no idea how.
>
> FastCGI is handling all the requests up from '/'
>
> My lightttpd config(part for fastcgi) - Thanks to Miguel Cobá (http://miguel.leugim.com.mx/index.php/2008/09/27/gemstones-and-fastcgi-with-lighttpd/):
>
> # forward the request to the fastcgi hosts
> fastcgi.server = ( "/" => (
>    ( "host" => "127.0.0.1", "port" => 9001, "check-local" => "disable"),
>    ( "host" => "127.0.0.1", "port" => 9002, "check-local" => "disable"),
>    ( "host" => "127.0.0.1", "port" => 9003, "check-local" => "disable")
>  )
> )
> # enabling server dir listing to prove if lighttpd is serving the files - ok
> server.dir-listing          = "enable"
>
> -> When I switch off fastcgi server I can lighttpd is serving the files.
>
> I tried to add:
> * a new Seaside Dispatcher: 'resources' with server path '/var/www/resources'
> * configuration in lighttpd:
>        alias.url += ( "/resources/" => "/var/www/resources" )
> * url.rewrite-once = (
>                        "^(/resources.*)$" => "$1",
>                        "^(/.*)$" => "/$1"
>                )
> * I read the seaside docs, the web and book.seaside.st (which covers static file serving, but with apache)
>
>
> I think it is no difficult setting.
>
> Anybody out to help?
>
>
> Best regards
>
>
> Mark
>
>
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside