cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a test version of a perl-based site on ccgi server?

WNewall
Dabbler
Posts: 20
Registered: ‎29-10-2008

How to create a test version of a perl-based site on ccgi server?

I have a live site on the ccgi server that uses perl cgi scripts.
I want to create a test version of the live site also on the ccgi server, so that updates to the site can be tested on the test version before making it live on the real domain.
I've tried a number of things to try and create a live test version of this site, but I haven't been able to work out a solution to get the perl scripts to work, so does anyone have any suggestions?
Background:
I have my own domain that is pointing to the ccgi server. So, using this www.mydomain I can view the live site.
Using a RewriteRule in the .htaccess file in the home folder, I can get  ccgi.mydomain to redirect to a sub-folder, so that I can create the test server inside this sub-folder. So, I can use the ccgi.mydomain domain to view the html pages of the test version of the site. So the sites are structured like this:
/index.html - index of live site, accessed via www.mydomain
/test_folder/index.html - index for test version, accessed via ccgi.mydomain
However, I can't work out how to get the perl scripts for the test site working. perl scripts only work if they are inside/below the top-level /cgi-bin folder, so they wont work if they are in /test_folder/cgi-bin. So, I tried to move the whole of the test site into /cgi-bin and changed to ReWrite to point to /cgi-bin/test_folder. This again works for the html files, but not the perl scripts. The perl scripts are accessed using URLs like /cgi-bin/zz.pl and it looks as if the apache webserver always intercepts URLs starting with /cgi-bin, so that the ReWrite redirect for the test domain is ignored i.e. if you browse to http://ccgi.mydomain/cgi-bin/zz.pl, it ignores the ReWrite and actually runs /cgi-bin/zz.pl instead of running /test_folder/cgi-bin/zz.pl
I'm stumped! Has anyone done anything similar and got it to work? Maybe there's a completely different way of doing it, that I haven't thought of...
Thanks,
Woll
1 REPLY 1
WNewall
Dabbler
Posts: 20
Registered: ‎29-10-2008

Re: How to create a test version of a perl-based site on ccgi server?

No replies, so obviously it's too complicated for anyone to answer!
Here's a bit more explanation and what my conclusion is so far...
The live site has things in cgi-bin and an index.html in the root folder and the perl scripts are accessed from the html pages using URLs like '/cgi-bin/zz.pl'. The most natural way to create the test version would be to create a 'test_site' folder at the top level and reproduce the same hierarchy as the live site below that folder - with no changes to the source/html - and have a ReWrite to redirect the test site domain to the 'test_site' folder. However, that wont work because the Force9 server doesn't allow perl scripts outside of cgi-bin.
To get round that, you could have the test site below /cgi-bin, but that also wouldn't work, because the server setup ignores ReWrite rules if the URL starts with '/cgi-bin' (I guess something to do with the way the ScriptsAlias directive works), so the URLs in the source like '/cgi-bin' wont get redirected and will end up running the scripts in the live site instead of the scripts in the test site!
At the moment, I am thinking that the only way to do it would be to create the test site by uploading the new version of the site to the server and then actually editing the URLs in all the files (using an automated script!), so that the perl scripts are called using URLs like '/cgi-bin/test_site/zz.pl', instead of directly like '/cgi-bin/zz.pl'. And then when the test site needs to go live, move it into the live site folder and re-edit all the CGI script URLs back to be '/cgi-bin/zz.pl'.
Woll