Re: [Dancer-users] Dancer-users Digest, Vol 11, Issue 2
Your Rewrite is using .cgi instead of .fcgi. Also it doesn't have a DirectoryIndex. Did you know you could do ... <Files "app"> SetHandler cgi-script </Files> Which in effect treats "app" as a file not a folder :) No more need for symlink ln -s ... - Your truely Sent from my Verizon Wireless BlackBerry -----Original Message----- From: dancer-users-request@perldancer.org Sender: dancer-users-bounces@perldancer.org Date: Sun, 02 Jan 2011 12:00:02 To: <dancer-users@perldancer.org> Reply-To: dancer-users@perldancer.org Subject: Dancer-users Digest, Vol 11, Issue 2 Send Dancer-users mailing list submissions to dancer-users@perldancer.org To subscribe or unsubscribe via the World Wide Web, visit http://www.backup-manager.org/cgi-bin/listinfo/dancer-users or, via email, send a message with subject or body 'help' to dancer-users-request@perldancer.org You can reach the person managing the list at dancer-users-owner@perldancer.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Dancer-users digest..." Today's Topics: 1. Re: CGI/FCGI deployment & uri_for (Naveed Massjouni) ---------------------------------------------------------------------- Message: 1 Date: Sat, 1 Jan 2011 06:38:50 -0500 From: Naveed Massjouni <naveedm9@gmail.com> Subject: Re: [Dancer-users] CGI/FCGI deployment & uri_for To: Robert Olson <bob@rdolson.org> Cc: Dancer-users@perldancer.org Message-ID: <AANLkTin+b=YygZ=Qw0HbH1cqVRNo+i6+jdzx1k0P00e-@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 On Tue, Dec 28, 2010 at 5:53 PM, Robert Olson <bob@rdolson.org> wrote:
It seems I must be doing something dumb, but I'm not seeing it.
I'm putting up a dancer app for a domain hosted at dreamhost. I created the app using the latest 1.2 dancer, and changed the webroot for the domain to appdir/public using the DH config panel. The following .htaccess is in place:
AddHandler fastcgi-script .fcgi Options +FollowSymLinks +ExecCGI
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule (.*) /dispatch.cgi/$1 [QSA,L]
Access to the routes works like a champ (including Net::Google::FederatedLogin authentication which I may turn into a plugin; also thinking about a CGI::FormBuilder plugin like Catalyst's).
However, uri_for returns a path that includes the rewritten path with dispatch.cgi in it:
uri_for("/dog") => http://<domain>/dispatch.cgi/dog
I'm assuming it should instead return http://<domain>/dog.
This seems like something there is an easy solution to, but I'm not finding it. Does anyone have any advice?
A simple thing that I do when deploying a CGI app is using a soft link instead of a rewrite rule: cd /var/www/cgi-bin # your system's cgi-bin may be at a different location ln -s /path/to/myapp/public/dispatch.cgi myapp You need to tell your web server to treat '^/myapp' as a cgi script. Then you can visit http://<domain>/myapp and it will be the root of your app. uri_for("/dog") should then return http://<domain>/myapp/dog I usually deploy as CGI for playing around or for development. When deploying for production, I use FastCGI, and then it is easy to mount your app to '/' or '/whatever'. -Naveed
Thanks, --bob _______________________________________________ Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
------------------------------ _______________________________________________ Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users End of Dancer-users Digest, Vol 11, Issue 2 *******************************************
I should have noted the behavior was identical with fcgi and cgi. I brought this all up partly to work out what the deployment documentation should say, since that configuration came directly from there. If the recommended deployment doesn't work correctly, that's a bug in the documentation. --bob On Jan 2, 2011, at 8:43 AM, awnstudio@gmail.com wrote:
Your Rewrite is using .cgi instead of .fcgi. Also it doesn't have a DirectoryIndex. Did you know you could do ...
<Files "app"> SetHandler cgi-script </Files>
Which in effect treats "app" as a file not a folder :) No more need for symlink ln -s ...
- Your truely
Sent from my Verizon Wireless BlackBerry
-----Original Message----- From: dancer-users-request@perldancer.org Sender: dancer-users-bounces@perldancer.org Date: Sun, 02 Jan 2011 12:00:02 To: <dancer-users@perldancer.org> Reply-To: dancer-users@perldancer.org Subject: Dancer-users Digest, Vol 11, Issue 2
Send Dancer-users mailing list submissions to dancer-users@perldancer.org
To subscribe or unsubscribe via the World Wide Web, visit http://www.backup-manager.org/cgi-bin/listinfo/dancer-users or, via email, send a message with subject or body 'help' to dancer-users-request@perldancer.org
You can reach the person managing the list at dancer-users-owner@perldancer.org
When replying, please edit your Subject line so it is more specific than "Re: Contents of Dancer-users digest..."
Today's Topics:
1. Re: CGI/FCGI deployment & uri_for (Naveed Massjouni)
----------------------------------------------------------------------
Message: 1 Date: Sat, 1 Jan 2011 06:38:50 -0500 From: Naveed Massjouni <naveedm9@gmail.com> Subject: Re: [Dancer-users] CGI/FCGI deployment & uri_for To: Robert Olson <bob@rdolson.org> Cc: Dancer-users@perldancer.org Message-ID: <AANLkTin+b=YygZ=Qw0HbH1cqVRNo+i6+jdzx1k0P00e-@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1
On Tue, Dec 28, 2010 at 5:53 PM, Robert Olson <bob@rdolson.org> wrote:
It seems I must be doing something dumb, but I'm not seeing it.
I'm putting up a dancer app for a domain hosted at dreamhost. I created the app using the latest 1.2 dancer, and changed the webroot for the domain to appdir/public using the DH config panel. The following .htaccess is in place:
AddHandler fastcgi-script .fcgi Options +FollowSymLinks +ExecCGI
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule (.*) /dispatch.cgi/$1 [QSA,L]
Access to the routes works like a champ (including Net::Google::FederatedLogin authentication which I may turn into a plugin; also thinking about a CGI::FormBuilder plugin like Catalyst's).
However, uri_for returns a path that includes the rewritten path with dispatch.cgi in it:
uri_for("/dog") => http://<domain>/dispatch.cgi/dog
I'm assuming it should instead return http://<domain>/dog.
This seems like something there is an easy solution to, but I'm not finding it. Does anyone have any advice?
A simple thing that I do when deploying a CGI app is using a soft link instead of a rewrite rule:
cd /var/www/cgi-bin # your system's cgi-bin may be at a different location ln -s /path/to/myapp/public/dispatch.cgi myapp
You need to tell your web server to treat '^/myapp' as a cgi script. Then you can visit http://<domain>/myapp and it will be the root of your app. uri_for("/dog") should then return http://<domain>/myapp/dog
I usually deploy as CGI for playing around or for development. When deploying for production, I use FastCGI, and then it is easy to mount your app to '/' or '/whatever'.
-Naveed
Thanks, --bob _______________________________________________ Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
------------------------------
_______________________________________________ Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
End of Dancer-users Digest, Vol 11, Issue 2 ******************************************* _______________________________________________ Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
participants (2)
-
awnstudio@gmail.com -
Robert Olson