http://www.perlmonks.org?node_id=11132161

plvicente has asked for the wisdom of the Perl Monks concerning the following question:

Hello Perl Monks,

Should I use this way or this way?

use Mojolicious::Lite; app->config( hypnotoad => { listen => [ 'http://127.0.0.1:8082/' ], proxy => 1, }, ); # the rest of your application goes here

For mojolicious Apache2

Or this way =>

LoadModule proxy_module lib/httpd/mod_proxy.so LoadModule proxy_http_module lib/httpd/mod_proxy_http.so <Proxy *> Order allow,deny Allow from all </Proxy> <VirtualHost *:80> ServerName app1.somehost.com ProxyPass / http://localhost:3000/ ProxyPassReverse / http://localhost:3000/ </VirtualHost> <VirtualHost *:80> ServerName app2.somehost.com ProxyPass / http://localhost:3001/ ProxyPassReverse / http://localhost:3001/ </VirtualHost>

Should I keep this as it is or should I look for other solution?
Instead this eg.

#!/usr/bin/perl -wT use strict; use CGI; my $query = CGI->new(); print $query->header( "text/html" ), $query->start_html(-title => "My First CGI Script", -bgcolor => "#ffffcc" ), $query->h1( "This is a pretty lame web page" ), $query->p( "Who is this Ovid guy, anyway?" ), $query->end_html
I am seeking for solutions to be done on an apache2 server. Take care Monks.

Best Regards Monks,
plvicente

Replies are listed 'Best First'.
Re: Best suite
by hippo (Bishop) on May 06, 2021 at 16:44 UTC
    print $query->header( "text/html" ), $query->start_html(-title => "My First CGI Script", -bgcolor => "#ffffcc" ), $query->h1( "This is a pretty lame web page" ), $query->p( "Who is this Ovid guy, anyway?" ), $query->end_html

    Whatever you decide to do, don't do that. See the CGI.pm docs for reasons to avoid this.


    🦛

Re: Best suite
by karlgoethebier (Abbot) on May 06, 2021 at 17:33 UTC

    Proxying your application server (whatever it is) isn’t a bad idea IMHO. Please see this as well as this for further inspiration. I had some success in the past with Tomcat and NGINX. Unfortunately Perl wasn’t part of the projects. Less or more. I placed some «Perls» in it called by Java 😜😎. Guerrilla tactics. Best regards, Karl.

    «The Crux of the Biscuit is the Apostrophe»

      Thank you for all answers and quick. I am learning how to use perl cgi. I am unix systems background. I asked and thank you in due which it suites better. My application for apache2 is a mix, so I need to know which parameters should work better.

        For a light-weight, powerful, non-monolithic, friendly, stable, easy-to-get started platform for modern web development I strongly recommend you experiment with Dancer2.

        Hope this helps!


        The way forward always starts with a minimal test.
        I am learning how to use perl cgi

        Please don't...
        As others have said, Mojolicious, Dancer2 or my choice is Template - anything except CGI.pm!

Re: Best suite
by haukex (Bishop) on May 06, 2021 at 17:14 UTC