librelist archives

« back to archive

[blohg] authentication problem when deploying

[blohg] authentication problem when deploying

From:
刘一新
Date:
2012-06-11 @ 08:34
hi, all

I and another guy bought a VPS, and the VPS has only one public IP address.
I and the other guy use different username, say user1 and user2, to log
into the VPS. We decide to use lighttpd to deploy our websites. His site is
a wordpress site, so its in PHP. And mine is a blohg app.

In lighttpd conf we have to set a server.group and server.user. If we use
user1 or user2, then lighttpd cannot access user2 or user 1's root
directory, respecitively. If we add another user, say lighttpd:lighttpd,
then I should chown my site's user:group to lighttpd:lighttpd, then hg will
complain. How can I sovle this problem?

Thanks!

-- 
*Yi-Xin Liu, PHD*
*Department of Macromolecular Science*
*Fudan University*
*Room 415, Yuejing Building *
*Handan Rd. 220, **Shanghai, China*
*Tel +86-021-65642863*
*Mobile +86-13916819745*
http://www.ngpy.org

Re: [blohg] authentication problem when deploying

From:
Ry4an Brase
Date:
2012-06-11 @ 14:58
On Mon, Jun 11, 2012 at 04:34:52PM +0800, 刘一新 wrote:
> I and another guy bought a VPS, and the VPS has only one public IP address.
> I and the other guy use different username, say user1 and user2, to log
> into the VPS. We decide to use lighttpd to deploy our websites. His site is
> a wordpress site, so its in PHP. And mine is a blohg app.
> 
> In lighttpd conf we have to set a server.group and server.user. If we use
> user1 or user2, then lighttpd cannot access user2 or user 1's root
> directory, respecitively. If we add another user, say lighttpd:lighttpd,
> then I should chown my site's user:group to lighttpd:lighttpd, then hg will
> complain. How can I sovle this problem?

This is more of a general Mercurial question than a blohg one, but you
just need to make sure that your upload mechanism uploads the files with
group ownership of 'lighttpd', which may require adding 'user1' and
'user2' to that group and then using the 'sticky group bit' on the
directories to make sure that newly created files have that group and
not your own.  This is core POSIX file system stuff, but also covered in
the Mercurial wiki.

That said, c'mon get your own server. :)  Failing that you can always
use the blohg frozen mode to publish to Amazon's S3 which is almost free
and with cloud front very fast.

-- 
Ry4an Brase - http://ry4an.org/

Re: [blohg] authentication problem when deploying

From:
刘一新
Date:
2012-06-12 @ 01:42
Thanks, ry4an. I've solved it last night by trial and error.

First, I create a virtual host with $HTTP["host"], and set
server.document-root, fastcgi.server, alias.url, url.rewrite-once and
server.error-handler-404 in there:

$HTTP["host"] =~ "(^|\.)ngpy\.org$" {
server.document-root = "/home/lyx/homepage"
fastcgi.server = (
                   "/" =>
                        ((
                                "host" => "127.0.0.1",
                                "port" => 8080,
                                "check-local" => "disable",
                                "max-procs" => 1,
                                "fix-root-scriptname" => "enable"
                        ))
                  )
alias.url = (
                "/static/" => "/home/lyx/homepage/static"
            )
url.rewrite-once = (
                        "^(/static.*)$" => "$1"
                   )
server.error-handler-404 = "/home/lyx/homepage/lyx.fcgi"
}

And for the other guy's PHP site, I create another virtual host, while in
the main conf I set the user and group to user2. Other settings are almost
in default. Then everything works fine. I have not encountered any
authentication problem. Note that here my site is still user1:user1, and
his is still user2:user2.

2012/6/11 Ry4an Brase <ry4an-blohg@ry4an.org>

> On Mon, Jun 11, 2012 at 04:34:52PM +0800, 刘一新 wrote:
> > I and another guy bought a VPS, and the VPS has only one public IP
> address.
> > I and the other guy use different username, say user1 and user2, to log
> > into the VPS. We decide to use lighttpd to deploy our websites. His site
> is
> > a wordpress site, so its in PHP. And mine is a blohg app.
> >
> > In lighttpd conf we have to set a server.group and server.user. If we use
> > user1 or user2, then lighttpd cannot access user2 or user 1's root
> > directory, respecitively. If we add another user, say lighttpd:lighttpd,
> > then I should chown my site's user:group to lighttpd:lighttpd, then hg
> will
> > complain. How can I sovle this problem?
>
> This is more of a general Mercurial question than a blohg one, but you
> just need to make sure that your upload mechanism uploads the files with
> group ownership of 'lighttpd', which may require adding 'user1' and
> 'user2' to that group and then using the 'sticky group bit' on the
> directories to make sure that newly created files have that group and
> not your own.  This is core POSIX file system stuff, but also covered in
> the Mercurial wiki.
>
> That said, c'mon get your own server. :)  Failing that you can always
> use the blohg frozen mode to publish to Amazon's S3 which is almost free
> and with cloud front very fast.
>
> --
> Ry4an Brase - http://ry4an.org/
>



-- 
*Yi-Xin Liu, PHD*
*Department of Macromolecular Science*
*Fudan University*
*Room 415, Yuejing Building *
*Handan Rd. 220, **Shanghai, China*
*Tel +86-021-65642863*
*Mobile +86-13916819745*
http://www.ngpy.org