2009/7/15 Miguel Enrique Cobá Martinez <miguel.coba@gmail.com>
El mié, 15-07-2009 a las 01:32 -0300, Mariano Martinez Peck escribió:
> Hi folks!  I have a website which is in development with pier. As it
> is in development there was no lighttpd or apache and I wanted them to
> wait :)  But...In another thread of this mail, thanks John, I just
> realised that I want to configure my lighttpd with Pier now. The
> problem is that I know very little about lighttpd neither apache. I
> want to use lighttpd. But I don't know how to configure.
>
> I saw Miguel (Miguel pensé mandarte un mail privado pero aprovecho que
> tal vez le sirve a otro) post here:
> http://miguel.leugim.com.mx/index.php/2008/09/27/gemstones-and-fastcgi-with-lighttpd/
> and I wonder which is the difference between what configuration and
> the one I need for my pier site. I remove Gemstone and FastCGI from
> that post but I add Pier hahah.
>
> I also saw http://www.piercms.com/doc/deploy but I am using
> lighttpd :(
>
> I have lighttpd installed and listening. I am under Ubuntu 8.10.
>
> I want to statically serve:
>
> - My pictures -> I use the gallery plugins. I have those photos
> in /var/www/pictures
> - All css files. I have my own library for my website which has a
> stylesheet. But, what about the others css? should I serve ALL of
> them ?
> Would love to have them in /var/www/styles/
> - All javascript files. The same as above. All js of all libraries ?
> Would love to have them in /var/www/javascripts/
> - What about the files I upload in Pier and are stored in  ~/files
> Would love to have them in /var/www/pierFiles
>
> Thanks a lot for the help!

> Mariano
Hola Mariano,

this is what I have in a site in production right now (it is not
complete):

$HTTP["host"] == "mysite.com" {
 $HTTP["scheme"] == "http" {
   url.redirect = ( "^/(.*)" => "https://mysite.com/$1" )
 }
}
$SERVER["socket"] == "123.123.123.123:443" {
 ssl.engine = "enable"
 ssl.pemfile = "/etc/lighttpd/ssl/mysite.com/mysite.com.pem"
 ssl.ca-file = "/etc/lighttpd/ssl/mysite.com/gd_bundle.crt"

 server.name = "mysite.com"
 server.document-root = "/srv/www/mysite.com/"

 # We'll use the resources directory to host static files: images,
styles, etc

 # Rewrite the URL
 url.rewrite-once = (
   "^/resources/(.*)" => "$0",        # Unaltered
   "^/about/(.*)" => "$0",        # Unaltered
   "^/(.*)" => "/seaside/myApp$1"   # Rewritten
 )

 # Anything with seaside/myApp pass to Seaside on port 8080
 proxy.balance = "hash"
 proxy.server = (
   "/seaside/myApp" => (
     ( "host" => "127.0.0.1", "port" => 8080)
   )
 )
}
$HTTP["host"] == "blog.mysite.com" {
 server.document-root = "/srv/www/blog.mysite.com/"
 alias.url = ( "/wp-uploads/" =>
"/srv/www/wp-uploads/blog.mysite.com/" )
}

For this I have everything on https and several folders are served
direct from disk on the document root from the lighttpd.
Also, you can have a lot more sites in the same server without problem,
just like the wordpress blog section.

For your case you need something like:

server.document-root = “/var/www/”

$HTTP["host"] == "yoursite.com" {

 # We'll use the resources directory to host static files: images,
styles, etc

 # Rewrite the URL
 url.rewrite-once = (
   "^/pictures/(.*)" => "$0",        # Unaltered
   "^/styles/(.*)" => "$0",        # Unaltered
   "^/javascripts/(.*)" => "$0",        # Unaltered
   "^/styles/(.*)" => "$0",        # Unaltered
   "^/files/(.*)" => "$0",        # Unaltered
   "^/(.*)" => "/seaside/myApp$1"   # Rewritten
 )

 # Anything with seaside/mySite pass to Seaside on port 8080
 proxy.balance = "hash"
 proxy.server = (
   "/seaside/myApp" => (
     ( "host" => "127.0.0.1", "port" => 8080)
   )
 )
}


For the files/ folder I don't know. According to the pier instructions,
the squeak files are stored on /srv/site/ (or /site/srv/, the
instructions have a typo, but imagine that it is /srv/site/)

So you have:

/srv/site/

and

/srv/site/files

The apache config proxy everything that doesn't exist on seaside/files/
to seaside. That is the reason for the document root for apache
in /srv/site/files/

But in the lighttpd example that I show the logic is, if it is a
specific folder, serve it directly and if it has seaside on it proxy to
seaside.

Anyway, give a couple hours and I'll send the equivalent exact and
complete config file for lighttpd and pier.

Miguel: it seems you know a lot about this :)  Nice explanation.
I will start playing a bit with this and see what happens.
Of course if you send me the example would be a dream, but I cannot give you a couple of hours but a couple of days even weeks if you want!!!

Thanks a lot man.

Mariano

 

Miguel Cobá