Git Product home page Git Product logo

fastcgi's Introduction

FastCGI for Delphi

This is an implementation of FastCGI for Delphi, written in Pascal. It implements the parts of the protocol that are necessary to build a simple web application using Delphi.

This means that you can write web applications in Pascal that serve dynamic content.

License and contributing

This software is distributed under the terms of the MIT license. You can use it for your own projects for free under the conditions specified in LICENSE.

If you have questions, feel free to contact me. Visit www.mvcxe.com for my contact details.

If you think you found a bug, you can open an Issue on Github. If you make changes to this library, I would be happy about a pull request.

Basic usage

The most common usage scenario is to use this library together with a web server nginx. The web server will serve static content and forward HTTP requests for dynamic content to your application.

Have a look at the NGINX.FCGIApplication.TFCGIApplication class for usage examples and more information.

This code example shows how to create a FastCGI application and receive requests:

// TFCGIApplication Object, will accept FastCGI requests
var 
  app: TFCGIApplication;

// Handle requests by responding with a 'Hello World' message
procedure TWebModule.FCGIRequestReceived(const sender: TObject;
  const Request: TFCGIRequest; Response: TFCGIResponse);
var
  Content: string;
  item: TPair<string, TBytes>;
begin
  Content := 'Hello World!<br/>这是中文内容<br/>';
  for item in Request.Parameters do
  begin
    Content := Content + ' ' + item.Key + '=' + TEncoding.UTF8.GetString
      (item.Value) + '<br/>';
  end;
  Response.Content := Content;
end;

// Create a new FCGIApplication
app := TFCGIApplication.Create;
app.OnRequestReceived := WebModule.FCGIRequestReceived;
// Start listening on port 19000
app.Run(19000);

Web server configuration

For nginx, use fastcgi_pass to pass requests to your FastCGI application:

location / {
    fastcgi_pass   127.0.0.1:19000; # Pass all requests to port 19000 via FastCGI.
    include fastcgi_params; # (Optional): Set several FastCGI parameters like the remote IP and other metadata.
}

For more details, refer to your web server documentation for configuration details:

fastcgi's People

Contributors

kylixfans avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fastcgi's Issues

支持Linux吗

因为nginx在linux下才能发挥性能, 所以最好能支持Linux了, 感谢你的付出.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.