Replies: 1 comment 2 replies
-
The recommended proxy setup is designed to run each application as a persistent server (using hypnotoad or the daemon or prefork command). This avoids the huge overhead of starting perl and loading modules every time a request is received, and is why CGI was obsoleted by fastcgi, mod_perl, and by proxying to application servers. If you want to be able to "drop in" a script then you would need a CGI server, such as apache or fcgiwrap. Mojo apps will transparently run as CGI scripts (though you may need to give them the .cgi extension depending on the server you use). But be aware, Mojolicious is optimized for persistent deployment not quick startup. If you want to write a script optimized for CGI deployment my only recommendation would be my own module, CGI::Tiny (see its docs for the problems with the usual suspects), but scripts using this would not be suitable for persistent deployment. |
Beta Was this translation helpful? Give feedback.
-
I have looked at https://docs.mojolicious.org/Mojolicious/Guides/Cookbook#Nginx . It's probably clear to nginx+mojo wizards, but not to occasional rare users o. Do I autostart another server (like hypnotoad) and let it run? Or use the server built into mojo lite itself? Not sure.
I have a more complex question, though, in the hope to make this task of hooking various standalone mojo-lite scripts into my nginx setup easier in the future.
I would love to run a number of different mojolicious lite scripts, coexisting with the nginx main server. think
https://myserver.com/mojo/script1 --> /var/www/mojo/script1.pl
https://myserver.com/mojo/script2 --> /var/www/mojo/script2.pl
https://myserver.com/mojo/script3 --> /var/www/mojo/script3.pl
ideally, but not necessarily, all I would have to do in order to activate a new script would be to drop it into /var/www/mojo/ . my scripts are not used super heavily...I am not Facebook. they are "lite" indeed. think a few routes only.
https://myserver.com/mojo/script1/
andhttps://myserver.com/mojo/script1/xx
andhttps://myserver.com/mojo/script1/xy
, and not many expected users at the same time (say <30, and more commonly <3).should I create a hypnotoad runner for each of my lite scripts? are there "farm" approaches here, that spawn automatically? or is this the whole idea behind mojolicious-lite scripts running when invoked directly with some parameters (as in fastcgi)?
step-by-step advice would be highly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions