[Catalyst] Fw: Fw: mod_fastcgi config for a Catalyst app.

Andrew catalystgroup at unitedgames.co.uk
Sun Oct 18 15:24:39 GMT 2015

----- Original Message ----- 
From: Andrew 
To: london.pm at groups.perlists.pm 
Sent: Sunday, October 18, 2015 3:50 PM
Subject: Re: Fw: mod_fastcgi config for a Catalyst app.

Amazingly it worked on my first attempt!



Here's what I did:

Placed the following in the includes file, which is called from between the virtual hosts tags, in my httpd.conf:

LoadModule fastcgi_module modules/mod_fastcgi.so
<IfModule mod_fastcgi.c>
FastCgiExternalServer /home/gamextra/public_html/GXCatalystTest/script/gxcatalysttest_fastcgi.pl -host www.game-extra.com:55900
Alias / /home/gamextra/public_html/GXCatalystTest/script/gxcatalysttest_fastcgi.pl/

Then at the command line, I ran:
script/gxcatalysttest_fastcgi.pl -l www.game-extra.com:55900 -p /tmp/myapp.pid

..and it worked!


At first, I had the Alias line as:
Alias /myapp/ /home/gamextra/public_html/GXCatalystTest/script/gxcatalysttest_fastcgi.pl/
...and what that did was give the impression nothing had worked, since www.game-extra.com didn't show the catalyst app running.
However, www.game-extra.com/myapp/ did show the catalyst app running. So whatever you put at the start of that alias is pretty much the path in the URL you want your catalyst app to run at, =), which was cool to learn.

I still don't know if 
FastCgiExternalServer /home/gamextra/public_html/GXCatalystTest/script/gxcatalysttest_fastcgi.pl
...is just a fictional filename that could be anything, or always has to literally point to your fastcgi script in the catalyst app's script folder.

And I still don't know why:
-host www.game-extra.com:55900
....has 55900 at the end. I guess that's the port to talk on. Can it be any number, or is there some significance to it being 55900...?

Finally, how come the tutorial at:
...says you should use socket for less overhead if the app is actually on the apache server.
...advises we use a TCP connection instead.
I'm guessing the Calendar article advises us to have more flexibility, whereas the wiki article advises us to use less overhead, and that whether you want flexibility or less overhead, should determine which approach you choose.


Next thing I need to learn:
If I've used:
script/gxcatalysttest_fastcgi.pl -l www.game-extra.com:55900 -p /tmp/myapp.pid
...to start the app.
How does one stop or restart it?
I shall have a google.
Any tips appreciated!



What have I learnt?

You put your apache configuration between the virtualhosts tags.

You can either do that directly within the httpd.conf file, after which you will have to run:
/usr/local/cpanel/bin/apache_conf_distiller --update
...to have your changes retained  (otherwise CPanel will revert it to whatever it wants - but this is all explained in the text at the top of httpd.conf anyway).

Or you can use separate includes files.
For example, at the end of the virtualhosts tags was the following:
# To customize this VirtualHost use an include file at the following location
# Include "usr/local/apache/conf/userdata/std/2_2/gamextra/game-extra.com/*.conf"
...so I removed the "#" from the second line, so it was no longer commented out, i.e.:
Include "usr/local/apache/conf/userdata/std/2_2/gamextra/game-extra.com/*.conf"
I then saved the httpd.conf file.
Then I went to the command line and entered:
/usr/local/cpanel/bin/apache_conf_distiller --update
....to retain the changes I just made.
Then I browsed to usr/local/apache/conf/userdata/std/2_2/
and created the folder gamextra
and then the folder game-extra.com
and then I made a file called try.conf

Inside try.conf, I put the following:

LoadModule fastcgi_module modules/mod_fastcgi.so
<IfModule mod_fastcgi.c>
FastCgiExternalServer /home/gamextra/public_html/GXCatalystTest/script/gxcatalysttest_fastcgi.pl -host www.game-extra.com:55900
Alias / /home/gamextra/public_html/GXCatalystTest/script/gxcatalysttest_fastcgi.pl/

Then I saved it.

Then I went to WHM (WebHostManager) and navigated to the restart services section,
and restarted http (apache), clicking the big blue YES button, =).

Then I went back to the command line, logged in as gamextra,
kept changing directory until I was in my catalyst application's folder
and entered the command line:
script/gxcatalysttest_fastcgi.pl -l www.game-extra.com:55900 -p /tmp/myapp.pid

Hang on.
That's what I did.
Not what I learnt. ^_^.
Oh nevermind.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/catalyst/attachments/20151018/2f9fdcd1/attachment.htm>

More information about the Catalyst mailing list