Я создал глобальный модуль hello на ubuntu 16.04
#include <httpd.h>
#include <http_protocol.h>
#include <http_config.h>
static int helloworld_handler(request_rec* r)
{
if (!r->handler || strcmp(r->handler, "helloworld"))
return DECLINED;
if (r->method_number != M_GET)
return HTTP_METHOD_NOT_ALLOWED;
ap_set_content_type(r, "text/html");
ap_rprintf(r, "Hello, world!");
return OK;
}
static void register_hooks(apr_pool_t* pool)
{
ap_hook_handler(helloworld_handler, NULL, NULL, APR_HOOK_MIDDLE);
}
module AP_MODULE_DECLARE_DATA helloworld_module = {
STANDARD20_MODULE_STUFF,
NULL,
NULL,
NULL,
NULL,
NULL,
register_hooks
};
, компилируя его с помощью этой команды:
apxs -iac mod_helloworld.c
Я вижу, как модуль запускает его
apache2ctl -M
и
a2enmod
, если я запустил
sudo a2enmod helloworld
Я вижу, что этот модуль уже включен
Как его настроить? для просмотра выходного вызова в браузере, например
localhost / helloworld
Я написал тот же вопрос в Stackoverflow, потому что я не знал, какой сайт более подходит для такого вопроса