----- Original Message ----- From: "Andrew" <london...@unitedgames.co.uk> To: <london...@groups.perlists.pm> Sent: Sunday, October 18, 2015 3:55 PM Subject: Re: mod_fastcgi config for a Catalyst app.
Thanks! I was wondering what to replace: "shinycms_example.com" with, for my own use, when I suddenly noticed everything was already working! =O. Shock! =). Just written a separate email about how I got FastCGI working on the first attempt, ^_^. Still sucks it took a day and a half of reading tutorials first. >_<. ----- Original Message ----- From: "Denny" <2...@denny.me> To: <london...@groups.perlists.pm> Sent: Sunday, October 18, 2015 3:08 PM Subject: Re: mod_fastcgi config for a Catalyst app. Hi Andrew, There's a sample Apache config and external fastcgi launcher command in ShinyCMS: https://github.com/denny/ShinyCMS/blob/master/docs/sample-apache-conf/httpd. conf https://github.com/denny/ShinyCMS/blob/master/bin/external-fastcgi-server Possibly having a look at those will help you figure out what to do with your own environment. Good luck! Cheers, Denny On Sat, 2015-10-17 at 22:13 +0100, Andrew wrote: > Could someone help me, with a bit of plain english please? > Am finding the tutorials on getting mod_fastcgi installed and working > a tad confusing. > > I have a VPS with Cpanel and WHM. > Apache 2.2.24 > A number of different user directories, > only one of which has to run a Catalyst app. > [Although it would be nice to use one user as a dev server, and > another user as a production server] > > I have downloaded http://fastcgi.com/dist/mod_fastcgi-current.tar.gz > I extracted this on the hard drive of my MacBook Pro. > This gave me the folder: > mod_fastcgi-2.4.6 > > On my VPS, my apache appeared to be installed at /usr/local/apache > ...so I opened up Makefile.AP2 within the mod_fastcgi-2.4.6 folder on > my laptop, using a text editor, and changed: > top_dir = /usr/local/apache2 > to the following: > top_dir = /usr/local/apache > ...so that the top directory path would be correct. > > I then uploaded the entire mod_fastcgi-2.4.6 folder to the root of my > VPS. > > I opened a terminal window and logged in as root, using SSH. > I changed directory to the folder I'd just uploaded: > cd mod_fastcgi-2.4.6 > Then I entered the three command lines in the installation > instructions, one after each other: > cp Makefile.AP2 Makefile > make > make install > > I then browsed to the folder: > /usr/local/apache/modules/ > ...and saw the file: > mod_fastcgi.so > ... was now in there, so assumed that's mod_fastcgi installed! =D > Hooray! > > So now I believe I need to: > Configure Apache. > Restart Apache. > Run my Catalyst App. > ....and this is where I'm having trouble. > > Here are my problems: > > PROBLEM ONE: > > Tutorials imply the following line should be added to the httpd.conf > file: > LoadModule fastcgi_module modules/mod_fastcgi.so > ...with modules being the folder mod_fastcgi.so is in on my VPS. > > So - my first question - where in httpd.conf do I put it? > At the very start? > In between the <Virtual Host> tags for the domain name I want the > Catalyst App to be at? > In the include conf files, for my domain name (the includes are in the > last line before the virtual host tag closes)? > Or do I forget about httpd.conf entirely, and shove it in a .htaccess > file, in my app's directory? > > From what I gather, External (aka Standalone Server Mode, aka as just > Server) is the best mode to run the app under. > This brings us nicely to.... > > PROBLEM TWO: > http://wiki.catalystframework.org/wiki/deployment/apache_fastcgi#Configure_A pache > ...gets pretty confusing here. > It gives the example of: > <IfModule mod_fastcgi.c> > FastCgiExternalServer /tmp/myapp.fcgi -host myhost:8081 > Alias /myapp/ /tmp/myapp.fcgi/ > </IfModule> > I need to know how to customise this for my purposes. > My server does have a /tmp/ directory, and I understand myapp.fcgi is > totally fictional and shouldn't exist. > Now - what about the rest of the first line? -host myhost:8081 > Documentation says we should change hostname and port as appropriate. > What throws me is that the next bullet point says that if the catalyst > app is actually on our apache server, that we should use "-socket > <filename>" instead of "-port <n>" .... this is odd, because in the > example, there is no "-port <n>" used anywhere. It then goes on to say > using "-host" will still work... then says we should use "localhost" > as the hostname... before then saying we could use "user -port" > instead, O_o. > So should the line be: > FastCgiExternalServer /tmp/myapp.fcgi -host > www.mydomainname.com:8081 > ...or: > FastCgiExternalServer /tmp/myapp.fcgi -host localhost:8081 > ...or: > FastCgiExternalServer /tmp/myapp.fcgi -socket > some-sort-of-filename-goes-here > (...which raises the question - what filename? mod_fastcgi > documentation says the filename of the unix domain socket the app uses > to communicate with the web server - I have no idea what that is, > =S. ) > ...or: > FastCgiExternalServer /tmp/myapp.fcgi gamextra -8081 > (..my attempt at interpreting user -port) > ...or should the line be something else entirely?? > I'm assuming: > Alias /myapp/ /tmp/myapp.fcgi/ > ...will be entirely correct as it is, yes? > > PROBLEM THREE: > Where do I put... > <IfModule mod_fastcgi.c> > FastCgiExternalServer /tmp/myapp.fcgi -host localhost:8081 > Alias /myapp/ /tmp/myapp.fcgi/ > </IfModule> > ....? The same place we put the LoadModule line in PROBLEM ONE...? > > I assume after solving these three problems, I simply: > Restart Apache. > Launch my catalyst app from the command line using lines similar to > the examples in the documentation. > Any advice on setting the -n flag? The > http://wiki.catalystframework.org/wiki/deployment/apache_fastcgi#Run_your_ap p_as_a_FastCGI_process example decides to run three parallel instances. > > UPDATE: > Just as I'm finishing this email, I see: > www.catalystframework.org/calendar/2006/16 suggests: > FastCgiExternalServer > /path/to/myapp/script/myapp_fastcgi.pl -host 127.0.0.1:55900 > Alias / /path/to/myapp/script/myapp_fastcgi.pl/ > # or Alias /myapp/ /path/to/myapp/script/myapp_fastcgi.pl/ to run at a > non root location > > My Catalyst app is at: > /home/gamextra/public_html/GXCatalystTest/script/gxcatalysttest_fastcgi.pl > Should I interpret that as.... > FastCgiExternalServer /home/gamextra/public_html/GXCatalystTest/script/gxcatalysttest_fastcgi.pl - host 127.0.0.1:55900 > Alias /myapp/ /home/gamextra/public_html/GXCatalystTest/script/gxcatalysttest_fastcgi.pl/ > ....? > Would that work as a solution to problem two? > If so - problem three - where would I put it? ^_^. > > Feedback appreciated - as this is something I could waste whole days > reading multiple tutorials on! > Already taken me a day to learn all I had to do was type three simple > command lines to install mod_fastcgi, =P....!! > > Huge thanks people, > > Yours, > Andrew. _______________________________________________ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/