brilant_blue has asked for the wisdom of the Perl Monks concerning the following question:
Hello dear Monks!
I am trying to run and deploy an app I wrote in Perl and Mojolicious.
When I use Morbo development server, everything is fine, pretty, fast and simple.
But:
When I try to change Apache httpd config file httpd.conf to work with my Mojolicious app according to documentation on the Internet, all pages of the web app are not available -- 404 HTTP error.
Webpages with docs:
http://mojolicio.us/perldoc/Mojolicious/Guides
http://mojolicio.us/perldoc/Mojolicious/Guides/Cookbook
http://mojolicio.us/perldoc/Mojo/Server/Morbo
http://mojolicio.us/perldoc/Mojo/Server/Hypnotoad
https://github.com/kraih/mojo/wiki/Apache-deployment
https://github.com/kraih/mojo/wiki/Hypnotoad-prefork-web-server
Relevant part of file httpd.conf (at the end of file):
<VirtualHost *:80> ServerName localhost ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8080/ <Perl> $ENV{PLACK_ENV} = 'production'; $ENV{MOJO_HOME} = '/var/www/MezlApp'; $ENV{MOJO_MODE} = 'deployment'; </Perl> <Location /> SetHandler perl-script PerlResponseHandler Plack::Handler::Apache2 PerlSetVar psgi_app /var/www/MezlApp/script/runapp </Location> </VirtualHost>
This is the last version of text in httpd.conf. After some playing with it I realized I have no idea how to deploy my app to Apache httpd server and I decided to try to play with Hypnotoad but with no positive effect yet.
When I try to run this app with Hypnotoad server:
$ cd ~
my home directory is /home/martin
$ hypnotoad PokusApp/runhtapp.pl
the command fails with this two sentences:
Deep recursion on subroutine "Mojo::Server::Hypnotoad::run" at /home/martin/PokusApp/runhtapp.pl line 7.
Deep recursion on subroutine "Mojo::Server::load_app" at /usr/share/perl5/vendor_perl/Mojo/Server/Hypnotoad.pm line 35.
File /home/martin/PokusApp/runhtapp.pl:
#!/usr/bin/perl use strict; use warnings; use Mojo::Server::Hypnotoad; my $hypnotoad = Mojo::Server::Hypnotoad->new; $hypnotoad->run('/home/martin/PokusApp/script/runapp'); # Line 7!
File /home/martin/PokusApp/script/runapp:
#!/usr/bin/perl use strict; use warnings; use FDI; # FileDirInfo BEGIN { unshift @INC, "$FDI::cfd/../lib"; } require Mojolicious::Commands; Mojolicious::Commands->start_app('PokusApp');
Where is the bug? What I made wrong?
My operatig system is Fedora 20 i386. I use Perl v5.18.2 and Mojolicious distribution from Fedora's repository. Output of:
$ perl -MMojolicious -e "print Mojolicious->VERSION"
is:
4.25
When I run tests:
$ PokusApp/script/runapp test
All tests successful. Result: PASS
Thank you for your help.
|
|---|