I am new to the programming world and started with Perl couple of days back. I tried developing a web application using Perl. Initially followed some tutorial and learned how to write simple CGI scripts using Perl and deployed it using Apache2 httpd server. After getting to know about the Perl Dancer it was much easier to develop a web application using the framework.As both serve the same purpose I want to know weather Dancer is a replacement to the Apache httpd server or dancer internally uses apache to start a server. As dancer is just a web application framework how internally it is managing to handle the server request and responses.
Can anybody post a link where I can read and get to know about how the webserver works?
Dancer has a PSGI interface.
PSGI is similar to CGI in that it allows a web server to communicate with the Perl application, but it is more efficient (it keeps the application running all the time so it doesn't need to load everything from scratch for each request) and has more features (e.g. the ability to use Plack middleware).
Dancer comes with a script to run a simple web server (which is not Apache) for development purposes.
It is expected that you'll use a more powerful web server (such as Apache HTTPD) in production.
Related
I was just trying to use Template::Toolkit perl module on my centos to generate dynamic web content. This tutorial, and the one given on cpan site, is made to bind mod_perl with Apache. I'm using nginx on my centos. i tried allot, but I'm less into server things, so failed each time. Can anyone help me to integrate mod_perl with nginx? Or is there any alternative for this?
mod_perl is an Apache module. It cannot be used with nginx.
To use Template::Toolkit with nginx, you will need to implement a web application some other way. Probably the most straightforward way of doing this will be to write it as a Plack application; this will allow it to be run as a HTTP or FastCGI server that nginx can proxy requests to.
I am a new back-end developer, I got a request that making a back-end can run on Apache server but I do not know what type of programming language can develop a back-end can run on that kind of server. I tried many queries about this topic but non result.Please help me!
I am planning to choose Golang for this project but I am confusing about it.
Unfortunately, Apache's module page doesn't list third party modules. However, there is a Wikipedia page that lists third party modules.
mod_aspdotnet - serves ASP.NET content using the Microsoft's ASP.NET hosting and .NET runtime
mod_cgi - executes CGI scripts
mod_cgid - executes CGI scripts using an external CGI daemon
mod_fcgid - high performance alternative to mod_cgi or mod_cgid
mod_fastcgi - enables FastCGI
mod_go - module for deploying web applications in Go
mod_jk - handles the communication between Tomcat and Apache
mod_lisp - for writing web applications in lisp
mod_lua - extends Apache with scripts written in Lua
mod_mono - provides ASP.NET support
mod_parrot - exposes the Apache API to a Parrot virtual machine interpreter
mod_perl - gives you a persistent Perl interpreter embedded in your web server
mod_php - enables usage of PHP within Apache
mod_prolog - embeds the Prolog interpreter within the server
mod_python - embeds the Python interpreter within the server
mod_r - embeds the R interpreter inside Apache
mod_ruby - embeds a Ruby interpreter in Apache
mod_suphp - executes PHP scripts with the permissions of their owners (unmaintained)
mod_wsgi - implements a WSGI compliant interface for hosting Python based web applications
It is likely that there are other modules that are unlisted because mod_go, mod_lua, and mod_prolog weren't included in the Wikipedia page. I found them by searching for "apache mod_golang", "apache mod_lua", and "apache mod_prolog". Also, a number of them no longer appear to be maintained.
We can say there are many languages which supports deployment on Apache web server. But here if you need a bunch of languages which runs natively on apache web server
Then you can visit this site https://en.m.wikipedia.org/wiki/Apache_HTTP_Server
And explore features tab in it.
And you can see last 7 option in it which says
"Embedded Perl, PHP and Lua scripting"
I know this is probably a stupid question. But I created a .rb file with Sinatra framework and I am not sure how to "deploy" it. When I posted the file on the server I just get a simple text file that reads back my code. It works great when I run it with Sinatra.
Thanks in advance!
It looks like your web server (Apache?) is just serving you with your Ruby script (that is a text, ASCII file) instead of running it (that is: instead of passing it through the Ruby interpreter).
Hence:
Is the Ruby interpreter installed on your server?
Is your web server configured to run Ruby scripts (files terminating with ".rb")
through the Ruby interpreter?
And, is Sinatra itself installed on your web server?
Anyway, Ruby applications (Rails, Sinatra, Padrino) are usually deployed to a server using GIT. Have a look at Heroku and Engine Yard.
Also, there are tools specifically designed to help the developer in deploying Ruby applications. Have a look at Capistrano or Vlad and/or Google for "how to deploy a sinatra application".
For Sinatra/Rails/etc, most people use a Webserver (ie Apache, Nginx, etc) AND an Application Server (Thin, Passenger, Unicorn). For a simple app these can live on the same host. The webserver manages the incoming traffic and the application server executes the ruby code and passes results to the webserver.
When you execute ruby app.rb to run your Sinatra application, you're actually loading up WEBrick which is an application server. Since your development machine is local, you can access it directly at localhost:3000 or some similar address.
Look into tutorial on setting up your webserver with Thin, it's one of the easier ones to work with. When/if you outgrow it, then look into Unicorn.
I'm trying to profile a web application written on top of HTML::Mason, I managed to set the profiler but it doesn't seem to pick-up the code inside the components. Is there a way to profile Mason applications using NYTProf?
I realize you're deploying this app under mod_perl, but one way to handle this would be to deploy under Plack and then use Plack::Middleware::Debug::Profiler::NYTProf. I haven't done this for Mason apps, but it was almost trivial to get some CGI::Application code running under Plack. Once you are able to deploy under Plack you get access to lots of great middleware components for debugging. If you can do this with little or no changes to the app itself, you could still continue to deploy to production under mod_perl but use Plack in development for stuff like NYTProf.
EDIT: I see now that I should have pointed you at Devel::NYTProf::Apache.
I have to do web service + web page on openwrt device. From web page I can send communications to a program which is running on the device, so I need to build web service and I don't know which to chose for lighttpd web server, I don't know if Soap Lite is compatible with openwrt+lighttpd.
Soap Lite is a "collection of Perl modules" for perl. You can use the cgi extension on lighttpd to use perl. So yes, it would work with lighttpd. The question is if your router has enough processing power to support lighttpd + cgi.