Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Installing Bugzilla on a shared hosting server

132 views
Skip to first unread message

Alen Peacock

unread,
Mar 13, 2006, 12:45:34 PM3/13/06
to support-...@lists.mozilla.org
David Miller wrote:
> Often providers that size will use "suexec" which will actually make the
> webserver run as you instead of under its own group, when running the
> perl scripts, but it'll still run as the webserver when accessing static
> files (like css and js files). If this is the case, you might be able
> to set webservergroup to your personal group, and then after running
> checksetup.pl, chmod o+rx on the directories containing js, css, gif,
> png, etc files, and chmod o+r on those files themselves.

Thanks for the tip! I just wrote a little script that does just that,
and it appears to work swimmingly. All the files are owned by my user
account, and bugzilla is set to run as my user group. The static files
(.js, .css, .png, .gif, .html, and .tmpl) are all o+r and directories
containing them are set o+rx. I also had to change all .htaccess files
to o+r. The script has to be run after checkconfig.pl, as
checkconfig.pl resets the ownership back.

It would be slick if checkconfig.pl could do this all by itself. I could add a
patch to do that if desired (my little script is in bash, maybe it would be
better to rewrite it in perl to fit in with the rest of bugzilla)? With the
increasing affordability of shared hosting combined with suexec, it
seems like this would open up bugzilla to a much larger audience (maybe
could even get it included in fantastico or other similar tools).

Here's the script. I'll offer it as GPL for now, but if it would be
useful to MPL it, I'd be happy to do so:

#!/bin/bash

function checkdir() {
cd $1
local hasstatic=0
for i in *; do
ext=${i##*.}
nonext=${i%.*}
if [ "$nonext" == "$ext" ]; then ext=""; fi
if [ "$ext" == "js" ] || [ "$ext" == "css" ]\
|| [ "$ext" == "gif" ]\
|| [ "$ext" == "png" ] || [ "$ext" == "html" ]\
|| [ "$ext" == "tmpl" ]; then
hasstatic=1
echo "o+r $i"
chmod o+r $i
fi
if [ -d "$i" ] && [ "$i" != "$1" ] && [ "$i" != "../" ]; then
checkdir $i;
r=$?
if [ $r == 1 ]; then
hasstatic=1
fi
fi
done;
if [ $hasstatic == 1 ]; then
cdir=`pwd`
echo "o+rx $cdir"
chmod o+rx $cdir
fi
cd ..

}

for i in `find . -name .htaccess`; do
echo "o+r $i";
chmod o+r $i;
done

checkdir $1;


Thanks again for the tip,
Alen

Alen

unread,
Mar 14, 2006, 11:17:23 PM3/14/06
to
For the benefit anyone stumbling upon this in the archives:

Here's an updated version of the script that is a bit safer (it won't
'escape' from the current directory if you forget to add a pathname arg
when invoking, and it exits immediately if you do forget that arg).
Use this instead:

#!/bin/bash

parent=$1

if [ ! -d "$parent" ]; then
echo "need to provide a path to start in"
exit
fi

function checkdir() {
pushd $1

popd
return $hasstatic
}

for i in `find . -name .htaccess`; do
echo "o+r $i";
chmod o+r $i;
done

checkdir $parent;

0 new messages