Answer the question
In order to leave comments, you need to log in
Is it possible to run a web application without CGI?
As far as I understand, the WEB application, working somewhere on the WEB server, must somehow communicate with it, and this role of the “communication protocol” is played by CGI. After reading about CGI, FastCGI and a little about Django, my question, which was not exhausted in the subject.
I want to know if a WEB application can work without using CGI?
There are probably other ways to communicate with the WEB server that I don't know yet.
PS:
Strongly do not kick for such a question. For some, this question is from the category of “captain”, but for me, web development is a new direction, in which I still don’t even reach the level of a “beginner” ) I just started to comprehend the basics of developing WEB applications.
Answer the question
In order to leave comments, you need to log in
There are a fairly large number of technologies that solve the problem of communication between a web application and a client (web server + CGI is just one of them). I can distinguish three classes of such technologies (someone can divide them differently, this is not for argument):
- CGI-like, when the server redirects requests to an application instance that runs as a separate process in the system, and uses the result of execution to return client;
- Fast-CGI-like, when the application runs as a daemon and serves web server requests;
- Application servers that execute code and serve requests in their own context.
Separately, you can install complex application servers that themselves perform all the functions of both applications and servers.
The choice of technology depends on the language and skill level.
CGI is simple, but inferior to FCGI in almost every way. Both technologies are used mainly when working with scripting languages (Perl, PHP).
Application servers are predominantly the Java world. Lots of specifics.
Yes, easily. There are many web applications that run on the client side without the use of CGI. As a rule, they work on Javascript.
To communicate with the web server, the application also does not need cgi. Data exchange can be done via XML, REST etc. Some applications do not need their own server at all if the data is obtained from third-party API services.
It is useless to ask such questions on Habré. =)
Most of the respondents wrote complete nonsense in places. The bulk of web programmers do not get beyond their frameworks, and as a result, they have a complete mess in their heads. For example, someone confuses the interface (WSGI, Pump, WEB3, PSGI, Rack, CGI, etc.), the application server (uWSGI, php-fpm, Rack, Gunicorn, unicorn, flup, Apache in this role, and more thousands of them) and protocol (HTTP, uwsgi, FastCGI, SCGI, CGI, AJP, WebSocket, lots of them). Someone confuses the protocol, the way it is implemented and the way the interpreter is launched.
The main thing you need to know is in the Django documentation:
docs.djangoproject.com/en/dev/howto/deployment/
The answer to your question is: yes, there are many and each HTTP server supports a whole set of protocols for communicating with the application server. And application servers can support one or more protocols, one or more interfaces. Some HTTP servers are able to perform a dual role, acting as an application server, providing a specific interface. And some applications themselves contain a built-in HTTP server. The term "web server" is too general, and can be interpreted in different ways.
The browser, when sending a request to the server, sends an HTTP request (an application layer protocol based on TCP). On the server, it can be accepted by any application that works with the HTTP protocol. In most cases, this is really a web server in its standard sense (apache, nginx, lIS ...), which, depending on its settings and the incoming request, can either transfer the request via CGI / FCGI to PHP / Python / any other language, or work out the request on your own (give a picture, block ...). But this is mainly applicable only for scripting languages and stateless applications. Statefull web applications (usually C/C++/Java/Delphi/C#) often use an embedded web server that provides HTTP communication without a third party external web server (apache, nginx)… Moreover, even when using apache ,
In order to execute scripts, the web server needs some kind of protocol to interact with those scripts. There are several of them:
- CGI
- FastCGI
- regular HTTP
- APIs built into the server (for connecting modules - like mod_perl and mod_php in Apache, or built-in perl support in nginx)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question