Deploying monkey server on ARM with FastCGI | بلاگ

Deploying monkey server on ARM with FastCGI

تعرفه تبلیغات در سایت

آخرین مطالب

امکانات وب

Vote count: 0

I'm facing a configration problem here.
What i'm trying to do is to deploy my own web server application using the fcgi librarie on ARM target (OS : Busybox)
here's my hello world program :

#include 
#include 
#include 

#define printf(...) FCGX_FPrintF(request->out, __VA_ARGS__)
#define get_param(KEY) FCGX_GetParam(KEY, request->envp)

void handle_request(FCGX_Request *request) {
    char *value;

    printf("Content-Type: text/plainrnrn");
    if ((value = get_param("REQUEST_METHOD")) != NULL) {
        printf("%s ", value);
    }
    if ((value = get_param("REQUEST_URI")) != NULL) {
        printf("%s", value);
    }
    if ((value = get_param("QUERY_STRING")) != NULL) {
        printf("?%s", value);
    }
    if ((value = get_param("SERVER_PROTOCOL")) != NULL) {
        printf(" %s", value);
    }
    printf("n");
}

int main(void) {
    int sock;
    FCGX_Request request;

    FCGX_Init(); 
    sock = FCGX_OpenSocket(":2005", 5);
    FCGX_InitRequest(&request, sock, 0);

    while (FCGX_Accept_r(&request) >= 0) {
        handle_request(&request);
        FCGX_Finish_r(&request);
    }

    return EXIT_SUCCESS;
}

here's my monkey.conf :

# Monkey HTTP Daemon - Configuration
# ==================================
# These are the main variables and their descriptions, defined in respect
# to the configuration of the different types of directives.

[SERVER]
    # Port:

    Port 2001

    # Listen:

    # Workers:

    Workers 1

    # Timeout:

    Timeout 15

    # PidFile:

    PidFile /var/run/monkey.pid

    # UserDir:

    UserDir public_html

    # Indexfile:

    Indexfile index.html index.htm index.php

    # HideVersion:

    HideVersion on

    Resume on

    User www-data

    KeepAlive off

    KeepAliveTimeout 5

    MaxKeepAliveRequest 1000

    MaxRequestSize 32

    SymLink Off

    TransportLayer liana

    DefaultMimeType text/plai

    FDT On

and my /sites/default configuration :

# Default Host - Configuration
# ============================
# Here the variable principals of the program are defined in respect
# to the configuration of the different types of directives.

[HOST]
    # ServerName:

    ServerName 127.0.0.1

    # DocumentRoot:

    DocumentRoot /var/www/

    # Redirect:

[LOGGER]
    # AccessLog:

    AccessLog /var/log/access.log

    # ErrorLog:

    ErrorLog /var/log/error.log

[ERROR_PAGES]
    404  404.html

#[CGI]
    # Per-vhost CGI matching, same rules as with the global match
    # Match /cgi-bin/.*.cgi

#[HANDLERS]
#    Match  *  fastcgi

I can't get how to configure your monkey to catch url and execute the C program .
If anyone got skills with FastCGI and Monkey, help is needed !!
At least how to configure it properly.

asked 11 secs ago

...
نویسنده : استخدام کار بازدید : 58 تاريخ : چهارشنبه 27 ارديبهشت 1396 ساعت: 21:57