[Catalyst] Feasibility questions ref transition to Catalyst

Andrew catalystgroup at unitedgames.co.uk
Wed Mar 2 07:39:57 GMT 2016


Just discovered something else that's pretty cool.

When setting up FastCGI in Apache,
you have something like:

<IfModule mod_fastcgi.c>
FastCgiExternalServer
/home/username/public_html/myapp/script/myapp_fastcgi.pl -host
www.mydomain.com:55900
Alias / /home/username/public_html/myapp/script/myapp_fastcgi.pl/
</IfModule>

...in your virtual host configuation.
(Because I have CPanel on my Apache server, I'm not editing the httpd.conf
file directly. Rather the httpd.conf file links to some include files, so I
just edit the include files.)

I realised the Alias bit, was making any URL from the domain name, go to the
Catalyst Web App.
However.... I had a few old CGIs I wanted to run.
I played about a bit, trying to copy and paste the CGI code into a new
Catalyst Controller... but I thought: "This is too much work".

The CGIs I wanted to run were in a directory - let's pretend the directory
was literally called "directory".
I added a new Alias line to this part of the Apache configuration:

<IfModule mod_fastcgi.c>
FastCgiExternalServer
/home/username/public_html/myapp/script/myapp_fastcgi.pl -host
www.mydomain.com:55900
Alias /directory /home/username/public_html/directory
Alias / /home/username/public_html/myapp/script/myapp_fastcgi.pl/
</IfModule>

.....Now...if the url is www.mydomain.com/directory it goes to the directory
folder in my public_html folder, and serves it just as apache always did,
including running the index.pl file I had there - a cgi perl script no less!
Everything else starting with www.mydomain.com gets sent to my new Catalyst
Web App.

In short - you can setup apache aliases, to still run some CGIs in specific
places, while all other URLs run your new Catalyst Web App, =).

That means you can have old CGI scripts and your new Catalyst web app,
running at the same domain name.
As long as there's no conflict of names. I.e. any Catalyst subroutine
designed to be triggered by the 'directory' path, won't get triggered, as
you've redirected all such requests to your directory folder instead.

I simply added a one line alias to achieve this. If there are better ways to
run your old CGIs on the same server as your new Catalyst app, I'm happy to
hear suggestions, =).

One idea that popped into my head was to maybe setup a subdomain that isn't
setup with fastcgi, and have all your old CGIs at the sub domain, running as
they normally would, on what's a normal apache subdomain. And then have your
Catalyst web app running at the normal web domain.
So if your CGIs were part of your old website,
you could have your new catalyst website at http://www.mydomain.com and your
old cgi website at http://old.mydomain.com
Then you wouldn't have the conflict of names problem.
http://www.mydomain.com/directory
and
http://old.mydomain.com/directory
...could both give different responses.

Some food for thought, =).

Yours,
Andrew.



----- Original Message -----
From: "Tom Browder" <tom.browder at gmail.com>
To: "The elegant MVC web framework" <catalyst at lists.scsys.co.uk>
Sent: Wednesday, February 17, 2016 8:20 PM
Subject: Re: [Catalyst] Feasibility questions ref transition to Catalyst


On Wed, Feb 17, 2016 at 10:03 AM, Andrew
<catalystgroup at unitedgames.co.uk> wrote:
>
> 1.  Is possible to move to Catalyst incrementally?  In other words, can I
> start deploying Catalyst using at least some of my existing static code?
>
> ---> I'm new to Catalyst, and have found, although as a framework, it sets
> up a structure in terms of folders and where scripts are, I can pretty
much
...

Good information, Andrew--thanks!

> ---> As a n00b, forgive me for not being sure what you mean by virtual
> hosts. I've managed to get everything working on a VPS from a web hosting

What I meant was I run multiple hosts (known as virtual hosts) on a
single instance of Apache on a single server.  Your operation on a
shared host is similar, so your answer was helpful.

Thanks so much.

Best,

-Tom

_______________________________________________
List: Catalyst at 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/




More information about the Catalyst mailing list