503 Service Unavailable

saroos1

Member
May 25, 2018
718
0
16
Hello,

I am having a few problems getting Cherokee to connect. I have no problems installing apache or lighttpd. I thought I would try Cherokee since you praise it so highly smiley.gif

1. I am using Debian lenny, and have successively installed the default cherokee install from its repos, however it is only version 0.72.

2. So I compiled 0.99.27 from the debians repositories with no problems along with the necessary php modules (VERSION PHP 5.2.6-1+lenny3 with Suhosin-Patch 0.9.6.2 (cli) (built: Apr 26 2009 22:16:23)for rtorrent to work.

3. I enter cherokee-admin -b[IP] in root and then netstat to see if its up and running, all fine up to till here. I get the Cherokee welcome page on the IP, BUT when i try to access the admin panel on port 9090 like so: http://IP:9090/ I get the 503 error. huh.gifhuh.gifhuh.gifhuh.gifhuh.gif

Can you help please?

Saroos
 

Attachments

simur612

Member
May 25, 2018
879
0
16
Honestly the best way to use cherokee-admin is over an ssh tunnel. If you're using windows you'll want to install "putty"
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

if you're using any unix based Desktop os then you can just use terminal and do something like

Code:
ssh -L 9090:localhost:9090 some.remote.server
then when you log in, simply type
Code:
sudo cherokee-admin
This will give you a password, it's going to be a bunch of random letters and numbers.
point your webbrowser at http://localhost:9090

username = admin
password = whatever was in the terminal window


this guide will explain how to use an ssh tunnel with putty via windows:
http://realprogrammers.com/how_to/set_up_an_ssh_tunnel_with_putty.html

you want it to look like
L9090 127.0.0.1:9090

in the putty window

when you open putty,. put your server ip/hostname in the session tab like this:



Then in the sidebar, expand SSH and select TUNNELS. in the SOURCE PORT window put 9090 and in the DESTINATION window put 127.0.0.1:9090 like this:



click add and you should see something like THIS:




then click OPEN to connect.

From there follow the instructions i gave earlier for cherokee-admin



this is what a SUCCESSFUL cherokee-admin+putty looks like
 

jith45

Member
May 25, 2018
960
0
16
Hello simur,

Firstly I have to thank you for the time you have invested in this, but I use puTTy everyday and understand what you have posted. As I said I have had version 0.72 (Deb lennys apt-get install version from repos) and have had no problems accessing the admin through my browser. Its since I updated to version 0.99.27 that I am experiencing the 503 error.

The admin and pass etc. all come up when I issue the cmd in root, but I can't login via the browser huh.gifhuh.gifhuh.gif.

THats where my problem is.
 

Attachments

simur612

Member
May 25, 2018
879
0
16
did you make sure to completely delete the older version before installing the new one?

just for shits and giggles, type this in shell and give me the response
Code:
which -a cherokee-adminif you see something like

/usr/sbin/cherokee-admin
/usr/local/sbin/cherokee-admin then you're probably using the old cherokee-admin which would likely give a 503 error.
 

saroos1

Member
May 25, 2018
718
0
16
Hi there again..lol

THis is what i get:
/usr/sbin/cherokee-admin

Which I assume means I am using the wrong one..lol
What do you suggest I do now, what is the path supposed to be? and in the meantime
I will download the latest tarball and try again
 

saroos1

Member
May 25, 2018
718
0
16
I have since reinstalled the OS and reinstalled with version 0.99.28 with the same result sad.gif
 

Attachments

simur612

Member
May 25, 2018
879
0
16
I dunno what to tell ya man.

Is there a compelling reason to USE linux over FreeBSD? If you don't have a very good reason, you ought to consider FreeBSD. It's an amazing os. It's more stable than debian, internet services run at lower load, you have access to ZFS and jails. With the ports system you can build everything from source without having to know a ton of flags. the firewall options are a ton better....all in all FreeBSD is amazing.

as far as your 503 error goes....I honestly don't know. This is very odd. I'd put a shout out on the mailing list.

I know there is an ubuntu version which a lot of people use without trouble. are you sure you're not missing a dependency? I know cherokee-admin is dependent on python.....

I'm sorry, i wish i could help.

If you decide to give FreeBSD a try i can help for sure. I honestly can't go back to linux now that i've been using "jails" for so long....it's just too good of a feature to not have.
 

saroos1

Member
May 25, 2018
718
0
16
Hello, I use dedicated servers and have used deb etch/lenny and centos OS. As I said, using Cherokee from the default repos on lenny work. I generally use Centos as my favoured OS. I usually use apache or lighttpd as my webservers but I thought I'd try Cherokee out. As far as dependancies, yes I have installed all dependancies as the install of the latest tarball goes really smooth with no hitches. It fires up with no errors in root, but its the browser part, that seems to be the problem.

I am going to do a fresh install with Debian Etch which might work. I'll report back. If all fails I'll use Centos, then give FreeBSD a shot
 

peshua19

Member
May 25, 2018
897
0
16
Hello, I use dedicated servers and have used deb etch/lenny and centos OS. As I said, using Cherokee from the default repos on lenny work. I generally use Centos as my favoured OS. I usually use apache or lighttpd as my webservers but I thought I'd try Cherokee out. As far as dependancies, yes I have installed all dependancies as the install of the latest tarball goes really smooth with no hitches. It fires up with no errors in root, but its the browser part, that seems to be the problem.

I am going to do a fresh install with Debian Etch which might work. I'll report back. If all fails I'll use Centos, then give FreeBSD a shot
Lo wonslung......

Success with Centos 5.4

A few tweaks needed but it worked out........thank you for you help

Stubs
 

simur612

Member
May 25, 2018
879
0
16
i wish i could have been of MORE help. Anyways, i'm glad you got it working. cherokee is unique among webservers. It's faster than lighttpd but easier to configure than apache.

I've found that it's as fast as nginx in most sitations, and faster in some.
 

randac56

Member
May 25, 2018
915
0
16
Been testing cherokee and so far seems to be a little quicker than lighttpd


ty wonslung....lol
stubs
 

peshua19

Member
May 25, 2018
897
0
16
yah, i'm a huge fan of cherokee. nginx is another great webserver. The thing that really makes cherokee unique though is the cheroke-admin webui. Theres nothing like it. It really makes setting up the webserver as easy as, say, setting up your router.

It's one of the fastest webservers i've seen for static content.

Another tip, for php, you should look into php-fpm

I don't really use the new version much (the newer versions can be compiled standalone)

I tend to go for the patch versions. It's partly because it's what i've been using for so long, and partly because it "feels" faster to me. Anyways, php-fpm adds a process manager to php. It's really slick stuff and it really makes php-cgi fly. I've been using it with nginx for quite some time.

anyways, it's a patch against php. The best thing to do, if you want to use php-fpm with all the same php settings you CURRENTLY have is to do this:

if you've got php installed, and you're using cherokee, set up a test.php page in your webroot with this
Code:
<?php phpinfo(); ?>

save it as test.php, then visit the page.


it should look something like this (your version may differ)



see the block that says "Configure Options"
That's the commands used to compile that version of php. Now all you need to do is download your php source code (you can get a different version but i wouldn't stil to the same major version, for example if you have 5.2.5 don't switch to 5.3.0 but you could go with 5.2.11)

download the source from here: http://php.net/downloads.php
then get the proper php-fpm patch here: http://php-fpm.org/downloads/
and the suhosin patch if you feel you need it (you can get away with not using it if you don't want it, it's a security feature) http://www.hardened-php.net/hardening_patch.14.html


gather the php sources and the php-fpm patch (and the suhosin patch if you want it) in the same directory, let's call it /usr/local/src

let's say you want to go with 5.2.11. untar the source like so
Code:
tar xzfv php-5.2.11.tar.bz2
then, to apply the php-fpm patch, run this command
Code:
gzip -cd php-5.2.11-fpm-0.5.13.diff.gz | patch -d php-5.2.11/ -p1
you can use the same type of a command if you wish to apply the suhosin patch if you want it
Code:
gzip -cd suhosin-patch-5.2.11-0.9.7.patch.gz | patch -d php-5.2.11 -p1

if you did these steps right, you should see stuff like this:
Code:
(Creating file main/suhosin_logo.h...)
Patching file main/suhosin_logo.h using Plan A...
Hunk #1 succeeded at 1.
Hmm... The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -Nura php-5.2.11/main/suhosin_patch.c suhosin-patch-5.2.11-0.9.7/main/suhosin_patch.c
|--- php-5.2.11/main/suhosin_patch.c 1970-01-01 01:00:00.000000000 +0100
|+++ suhosin-patch-5.2.11-0.9.7/main/suhosin_patch.c 2009-09-18 13:34:07.000000000 +0200
--------------------------
(Creating file main/suhosin_patch.c...)
Patching file main/suhosin_patch.c using Plan A...
Hunk #1 succeeded at 1.
Hmm... The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -Nura php-5.2.11/main/suhosin_patch.h suhosin-patch-5.2.11-0.9.7/main/suhosin_patch.h
|--- php-5.2.11/main/suhosin_patch.h 1970-01-01 01:00:00.000000000 +0100
|+++ suhosin-patch-5.2.11-0.9.7/main/suhosin_patch.h 2009-09-18 13:34:07.000000000 +0200
--------------------------
(Creating file main/suhosin_patch.h...)
Patching file main/suhosin_patch.h using Plan A...
Hunk #1 succeeded at 1.
Hmm... The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -Nura php-5.2.11/main/suhosin_patch.m4 suhosin-patch-5.2.11-0.9.7/main/suhosin_patch.m4
|--- php-5.2.11/main/suhosin_patch.m4 1970-01-01 01:00:00.000000000 +0100
|+++ suhosin-patch-5.2.11-0.9.7/main/suhosin_patch.m4 2009-09-18 13:34:07.000000000 +0200
--------------------------
(Creating file main/suhosin_patch.m4...)
Patching file main/suhosin_patch.m4 using Plan A...
Hunk #1 succeeded at 1.
Hmm... The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -Nura php-5.2.11/sapi/apache/mod_php5.c suhosin-patch-5.2.11-0.9.7/sapi/apache/mod_php5.c
|--- php-5.2.11/sapi/apache/mod_php5.c 2008-12-31 12:17:49.000000000 +0100
|+++ suhosin-patch-5.2.11-0.9.7/sapi/apache/mod_php5.c 2009-09-18 13:34:07.000000000 +0200
--------------------------
Patching file sapi/apache/mod_php5.c using Plan A...
Hunk #1 succeeded at 951.
Hmm... The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -Nura php-5.2.11/sapi/apache2filter/sapi_apache2.c suhosin-patch-5.2.11-0.9.7/sapi/apache2filter/sapi_apache2.c
|--- php-5.2.11/sapi/apache2filter/sapi_apache2.c 2008-12-31 12:17:49.000000000 +0100
|+++ suhosin-patch-5.2.11-0.9.7/sapi/apache2filter/sapi_apache2.c 2009-09-18 13:34:07.000000000 +0200
--------------------------
Patching file sapi/apache2filter/sapi_apache2.c using Plan A...
Hunk #1 succeeded at 566.
Hmm... The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -Nura php-5.2.11/sapi/apache2handler/sapi_apache2.c suhosin-patch-5.2.11-0.9.7/sapi/apache2handler/sapi_apache2.c
|--- php-5.2.11/sapi/apache2handler/sapi_apache2.c 2008-12-31 12:17:49.000000000 +0100
|+++ suhosin-patch-5.2.11-0.9.7/sapi/apache2handler/sapi_apache2.c 2009-09-18 13:34:07.000000000 +0200
--------------------------
Patching file sapi/apache2handler/sapi_apache2.c using Plan A...
Hunk #1 succeeded at 370.
Hmm... The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -Nura php-5.2.11/sapi/cgi/cgi_main.c suhosin-patch-5.2.11-0.9.7/sapi/cgi/cgi_main.c
|--- php-5.2.11/sapi/cgi/cgi_main.c 2009-06-09 15:29:39.000000000 +0200
|+++ suhosin-patch-5.2.11-0.9.7/sapi/cgi/cgi_main.c 2009-09-18 13:34:07.000000000 +0200
--------------------------
Patching file sapi/cgi/cgi_main.c using Plan A...
Hunk #1 succeeded at 1918 (offset 117 lines).
Hmm... The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -Nura php-5.2.11/sapi/cli/php_cli.c suhosin-patch-5.2.11-0.9.7/sapi/cli/php_cli.c
|--- php-5.2.11/sapi/cli/php_cli.c 2009-07-23 16:54:04.000000000 +0200
|+++ suhosin-patch-5.2.11-0.9.7/sapi/cli/php_cli.c 2009-09-18 13:34:07.000000000 +0200
--------------------------
Patching file sapi/cli/php_cli.c using Plan A...
Hunk #1 succeeded at 801.
Hmm... The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|diff -Nura php-5.2.11/win32/build/config.w32 suhosin-patch-5.2.11-0.9.7/win32/build/config.w32
|--- php-5.2.11/win32/build/config.w32 2009-03-13 15:39:08.000000000 +0100
|+++ suhosin-patch-5.2.11-0.9.7/win32/build/config.w32 2009-09-18 13:34:07.000000000 +0200
--------------------------
Patching file win32/build/config.w32 using Plan A...
Hunk #1 succeeded at 305.
Hunk #2 succeeded at 354.
done

without errors.

now, you should have your php sources fully patched. now all that is left to do is to take the "Configure Command" from your test-php page and add a single '--enable-fpm' to it

for example, mine looked like this before:
Code: [Select]
'./configure' '--with-layout=GNU' '--with-config-file-scan-dir=/usr/local/etc/php' '--disable-all' '--enable-libxml' '--with-libxml-dir=/usr/local' '--enable-reflection' '--program-prefix=' '--enable-fastcgi' '--with-regex=php' '--with-zend-vm=CALL' '--prefix=/usr/local' '--mandir=/usr/local/man' '--infodir=/usr/local/info/' '--build=amd64-portbld-freebsd7.2'
and afterwards, looks like this:
Code: [Select]
'./configure' '--with-layout=GNU' '--with-config-file-scan-dir=/usr/local/etc/php' '--disable-all' '--enable-libxml' '--with-libxml-dir=/usr/local' '--enable-reflection' '--program-prefix=' '--enable-fastcgi' '--with-regex=php' '--with-zend-vm=CALL' '--prefix=/usr/local' '--mandir=/usr/local/man' '--infodir=/usr/local/info/' '--build=amd64-portbld-freebsd7.2' '--enable-fpm'NOTE *!*!*!*!*!* Do not just copy mine, it will NOT WORK if you aren't on freebsd. your best bet, if you don't know how to configure, is to take the settings from the php test page from whatever php package your distro offers


run your new configure command inside the newly patched php directory (which should be something like /usr/local/src/php-5.2.11/ if you originally were in /usr/local/src)

now, so long as you have all the build dependencies for php, you shouldnt' run into any errors. If you DO, they are most likely common sense errors or stuff that can be solved on google. Otherwise, report them here and i'll see if i can help. anyways, if the configure passes, you just can just
Code:
make
make installwhich will install your new php, and the fpm stuff.

now, php-fpm has a pretty simple xml style config. by default, it installed to /usr/local/etc/php-fpm.conf
edit line 63 and 66 removing <-- ---> and adding in whatever user you use to run your web server. on ubuntu this is www-data, on freebsd it's www
on other systems, it may be something else

anyways, the lines should look something like this:
Code:
Unix user of processes
<value name="user">www</value>

Unix group of processes
<value name="group">www</value>

this should be the only edits you NEED to make in order to run php-fpm

now, if you're on a system when uses init.d based scripts, you can make one with the following code
Code:
#! /bin/sh

php_fpm_BIN=/usr/local/bin/php-cgi
php_fpm_CONF=/usr/local/etc/php-fpm.conf
php_fpm_PID=/usr/local/logs/php-fpm.pid


php_opts="--fpm-config $php_fpm_CONF"


wait_for_pid () {
try=0

while test $try -lt 35 ; do

case "$1" in
'created')
if [ -f "$2" ] ; then
try=''
break
fi
;;

'removed')
if [ ! -f "$2" ] ; then
try=''
break
fi
;;
esac

echo -n .
try=`expr $try + 1`
sleep 1

done

}

case "$1" in
start)
echo -n "Starting php_fpm "

$php_fpm_BIN --fpm $php_opts

if [ "$?" != 0 ] ; then
echo " failed"
exit 1
fi

wait_for_pid created $php_fpm_PID

if [ -n "$try" ] ; then
echo " failed"
exit 1
else
echo " done"
fi
;;

stop)
echo -n "Shutting down php_fpm "

if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi

kill -TERM `cat $php_fpm_PID`

wait_for_pid removed $php_fpm_PID

if [ -n "$try" ] ; then
echo " failed"
exit 1
else
echo " done"
fi
;;

quit)
echo -n "Gracefully shutting down php_fpm "

if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi

kill -QUIT `cat $php_fpm_PID`

wait_for_pid removed $php_fpm_PID

if [ -n "$try" ] ; then
echo " failed"
exit 1
else
echo " done"
fi
;;

restart)
$0 stop
$0 start
;;

reload)

echo -n "Reload service php-fpm "

if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi

kill -USR2 `cat $php_fpm_PID`

echo " done"
;;

logrotate)

echo -n "Re-opening php-fpm log file "

if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi

kill -USR1 `cat $php_fpm_PID`

echo " done"
;;

*)
echo "Usage: $0 {start|stop|quit|restart|reload|logrotate}"
exit 1
;;

esac

or if you are on a system which used rc.d scripts, you can use this code
Code:
#!/bin/sh

# PROVIDE: phpfpm
# KEYWORD: shutdown

#
# Add the following lines to /etc/rc.conf to enable php-fpm:
#
#phpfpm_enable="YES"
#
#

. /etc/rc.subr

name=phpfpm
rcvar=`set_rcvar`

command="/usr/local/sbin/php-fpm"
command_args=""
pidfile=/usr/local/logs/php-fpm.pid
required_files=/usr/local/etc/php-fpm.conf

# set defaults

phpfpm_enable=${phpfpm_enable:-"NO"}

start_cmd="phpfpm_start"
stop_cmd="phpfpm_stop"
restart_cmd="phpfpm_restart"

phpfpm_start()
{
if [ -f ${pidfile} ]
then
echo "php-fpm already running!"
exit 1;
fi
echo "Starting php-fpm server..."
/usr/local/bin/php-cgi --fpm
}
phpfpm_stop()
{
if [ ! -f ${pidfile} ]
then
echo "${name} is not running or pidfile not found!";
exit 1;
fi
echo "stopping ${name}..."
kill -SIGQUIT `cat ${pidfile}`
}
phpfpm_restart()
{
if [ ! -f ${pidfile} ]
then
echo "${name} is not running or pidfile not found!";
exit 1;
fi
echo "sending SIGUSR2 to php-fpm master"
kill -SIGUSR2 `cat ${pidfile}`
}

load_rc_config ${name}
run_rc_command "$1"


then simply making sure php-fpm is started, and changing the cherokee socket to match the one in your /usr/local/etc/php-fpm file (or vise versa)
shoudl be all you need


the thing that is so great about php-fpm is that...it totally handles spawning new php processes and killing old ones, which is something that is normally not able to be done by php, and requires outside help. it's amazingly quick, and you can even do stuff like run multiple versions of php by using different php-fpm users and changing the config file location. It's really quite amazing. I actually run my php-fpm on a unix socket, which isn't much different, just look for
Code:
<value name="listen_address">127.0.0.1:9000</value>
and change it so where ever you want the socket. I tend to make a dir in /var/run and make it owned by my web user
Code:
<value name="listen_address">/var/run/php-fpm/php.socket</value>

then change the cherokee interpreter to simply use the socket address instead
 

simur612

Member
May 25, 2018
879
0
16

Thank you again, I will look into this as it looks really interesting. On the dedicated servers I use i have had to update the php if i want to use certain modules. Most commercial servers I either come with php 5.1x pre-installed or when I do the install from the default repos its version 5.1x. But of recent times any modules I need I just install them now. Its a lot of grief upgrading from 5.1x to 5.2x.

I have tried installing freebsd on my vm to try it out....all went well until i tried to ssh in. KEpt giving me the keyboard authentication instead of normal login....so i left it unless you can tell me what my problem is there. Never encountered on any of the dedicated servers I've used (Centos5.2,5.3 lenny, etch)


ALl looks real interesting tho as I am looking into nginx
 

peshua19

Member
May 25, 2018
897
0
16


Thank you again wonslung, what fantastic link


I've been able to switch the use of apache to nginx, with relative ease using symlinks to run from the original install
. I adjusted some files and voila all running hunky dory. I deffo seen a big difference in speed of handling requests and the very light load
 

peshua19

Member
May 25, 2018
897
0
16
hi I have one question I just intalled rtorrent workign perfectly my quesiton is if I want to close or start rtorrent what code I need to type to terminal ?