#FastCGI

2025-05-17
@kimapr@ublog.kimapr.net @xyno@catgirl.cloud @giacomo@snac.tesio.it Indeed. I enjoy CGI, and have a bunch of CGI services written in awk, C, or sh command pipelines, with their outputs often embedded into HTML pages using SSI; they work very well even on $5 VPSes. It is my go-to for most personal things. In my experience, a CGI script is on average 100 times more efficient than whatever JS / .NET / Java / Python soup I have to deal with at my typical consulting work, but CGI is still wasteful, and I can juice 4x more throughput and 4x less latency from that $5 VPS if I hook the same C code to Apache directly. I'd take CGI over most thicker "modern" solutions, but CGI still triggers my mechanical sympathy pains :)

FastCGI was supposed to be better, but my experiments on Apache servers show it to be very close in performance to CGI when using mod_cgid (which tries to minimize fork() costs by running it from a tiny demon process, communicating with it over UNIX sockets iirc). My standing theory is that FastCGI was faster when CGI was more naive, or perhaps using older kernels where fork() might have been more expensive or something, but I don't really know for sure.

But anyway, my recommendation to write an Apache or NGINX module, or write a standalone server from scratch in assembly, are based on fun factor alone, not necessarily what I'd recommend for production. I'm more likely to recommend a CGI script for prod because other developers would be less afraid of working on it.
This post is sent from a #snac2 instance running as a #FastCGI
Oh, I run snac2 too, behind an Apache reverse-proxy,
didn't know it can run as a FastCGI script.
I will look that up, thanks :)
these forgotten technologies provide viable and cheap alternatives to #BigTech
Indeed, just tell them CGI is "serverless functions" and everyone would clap and say big yes :D
http://www.tesio.it/2024/12/18/how-to-run-your-own-social-network.html
I enjoyed this article, and learned about cgi-fcgi, thanks again.
https://code.tesio.it/p/self-hosting/doh.cgi/dir?ci=tip
Curious. I usually host a dnscrypt-proxy server on my VPN, to allow all my devices to access secure DNS. Self-hosted DoH with CGI sounds pretty interesting. Also yay for fossil :)

Hack on, friend~
2025-05-16
@rozenglass@fedi.dreamscape.link

This post is sent from a #snac2 instance running as a #FastCGI on a cheap shared hosting that only supports #CGI.

http://www.tesio.it/2024/12/18/how-to-run-your-own-social-network.html

On the other hand, my #DoH server is in fact a CGI running on another shared hosting.

https://code.tesio.it/p/self-hosting/doh.cgi/dir?ci=tip

IMHO, these forgotten technologies provide viable and cheap alternatives to #BigTech "cloud solutions" for 9 web application out of ten.

And if you code them in a natively compiled language (these are both C projects), their performance rock!

@kimapr@ublog.kimapr.net @xyno@catgirl.cloud @kimapr@ublog.kimapr.net
2025-04-27

As @matt_garber correctly pointed out, #FastCGI is the way to go. It does not fork and it does scale quite well. Again it was perceived as "non-fashionable" @zirias @wollman @rubenerd @dexter

Have been mucking around with docker, caddy and php-fpm to experiment with different ways of running sabre/Baikal. Kind of confused about the way the fastCGI works...

The try_files directive makes it seem like I have to mount everything on the web server, including php files even though these are not executed on my web server or within the same container?

Can I not just mount the static html files on the web server and only load php files to the container running php-fpm?

Doesn't feel super secure and definitely feels pretty old school.

#php #fastcgi #cgi #oss

2025-01-21

@gtsteel @philgyford are there ways to deploy applications developed with newer languages like #rust over #FastCGI? The only libraries I've found are to *run* FastCGI scripts, not *be* one 😑️

I just want a way to run my script so it stays active when in use but shuts off when not to save memory. Something that I feel is unique to small-scale deployments where you assume that your applications will *not* all be receiving traffic all the time

Paolo Melchiorrepaulox@fosstodon.org
2025-01-20

TIL Network protocols Sans I/O ⚡

“… network protocol implementations written in Python that perform no I/O (this means libraries that operate directly on text or bytes; this excludes libraries that just abstract out I/O).” 🤯

Read the reference page 👇
sans-io.readthedocs.io/

#Reusability #Python #FastCGI #HTTP2 #H11 #IRC #OAuth2 #OAuthLib #WebSocket #SOCKS5 #RFC2217 #SerialOverIP #EPICS #FIX #QUIC #LanguageServerProtocol #SMTP #DBus #ThorlabsAPT #Matrix #SSL #TLS #CPython #multipart #formdata

2024-12-31

This morning's project: Play with a gemini server that supports FastCGI.

So far I've been playing with gmid ¹ and it looks pretty nice. I was able to get it up and running as a docker container on my laptop, tested protected paths and even got a couple of Python scripts to run as FastCGI with a second fcgiwrap ² container 🤓.

I am thinking about making a small bookmarks app for my bookmarks so I can add/edit them directly on the browser without having to edit and commit my bookmarks file manually. I might use a SQLite db.

A different approach would be to use Titan, but that is something I still need to figure out.

1: https://gmid.omarpolo.com/
2: https://github.com/gnosek/fcgiwrap#readme-ov-file

#GeminiProtocol #gmid #fcgiwrap #FastCGI #SelfHosted

2024-12-09
Hello from my brand new #Snac instance running as a #FastCGI on a cheap shared hosting.. without FastCGI support!

Turns out all you need is good old cgi-fcgi and a starter script. I'll send you a PR with a proper example as soon as possible.

I think this shows how Snac is the cheapest and easiest to install #fediverse server, lowering the bar to self-hosting #privacy friendly instances for schools, group of friends or families.

And using it from #fedilab is just as easy as any other instance.

Thanks for the great work @grunfink@comam.es!
2024-12-05
This is a test from a new instance of @grunfink@comam.es's #snac running as a #FastCGI but started though cgi-fcgi from https://github.com/FastCGI-Archives/fcgi2

It turns out that you don't need to break down snac into a #CGI part and a crontab part to run it on a cheap shared hosting; you just need to compile both snac and cgi-fcgi statically with #musl.

Figuring out how to do such compilations was not trivial, but in fact it's pretty easy to do.

If everything works as expected, I'll write a little tutorial for anyone interested.

But I'm still not sure it really works...
2024-11-24

You may have noticed that our web server has been responding much faster since last Thursday. This is because we are now using much more powerful hardware and have completely replaced the software stack.

Have fun with the new performance!

#nginx #webserver #redis #fastcgi

2024-11-21

Configure CGI executable Environment on Nginx

Gea-Suan Lingslin@abpe.org
2024-07-31

nginx + AWStats

AWStats 是個很老牌的分析工具,直接對 access log 分析後提供報表,本來以為是完全沒在動的專案,但從版本記錄發現 2020 年與 2023 年各有一版修安全性問題,看起來還是有在維護?

會想到要裝是因為這幾天被砍站,CPU credit 低到觸發我設定的 alarm:

除了處理外,也想快速看一下發生什麼事情,而這種砍站的在 JavaScript 類的分析服務上不會看到,需要直接對 server log 分析,所以就想到 AWStats 了...

Ubuntu 可以透過 sudo apt install -y awstats

blog.gslin.org/archives/2024/0

#Computer #DevOps #Murmuring #Network #Software #SRE #WWW #awstats #cgi #devops #fastcgi #fcgiwrap #nginx #perl #sre

:mima_rule: Mima-samamima@makai.chaotic.ninja
2024-07-21

Man, if #DNSoverHTTPS is just this simple... ​:sagume_think:​

http://mima.localghost.org/dns/chaotic.ninja/AAAA

#!/bin/sh
if [ $REQUEST_METHOD == "GET" ]
then
    DNS_DOMAIN=$(echo "$QUERY_STRING" |
                 sed -n 's/^.*domain=\([^&]*\).*$/\1/p' |
                 sed "s/%20/ /g")
    DNS_TYPE=$(echo "$QUERY_STRING" |
               sed -n 's/^.*type=\([^&]*\).*$/\1/p' |
               sed "s/%20/ /g")
    [ -z $DNS_TYPE ] && DNS_TYPE=A
    if [ -d "$DNS_DOMAIN" ]
    then
        DNS_STATUS="NOERROR"
        LOCAL_REC="$DNS_DOMAIN/$DNS_TYPE"
        [ -e "$LOCAL_REC" ] && DNS_REC=$(cat "$LOCAL_REC")
    else
        DIG_RESPONSE=$(dig +noall +answer +comments "$DNS_DOMAIN" "$DNS_TYPE")
        DNS_STATUS=$(echo "$DIG_RESPONSE" | grep status | cut -d ':' -f 3 | cut -w -f 2 | cut -d ',' -f 1)
        if [ $DNS_STATUS == "NOERROR" ]
        then
            DNS_ANSWER=$(echo "$DIG_RESPONSE" | grep IN)
            DNS_REC=$(echo "$DNS_ANSWER" | cut -w -f 5-)
            DNS_TTL=$(echo "$DNS_ANSWER" | cut -w -f 2)
        fi
    fi
fi

httpstatus()
{
    case $1 in
        200) httpsemantic="OK";;
        404) httpsemantic="Not Found";;
    esac
    printf "HTTP/1.0 $1 $httpsemantic\r\n"
    echo "Status: $1 $httpsemantic"
}
case $DNS_STATUS in
    "NOERROR")
        if [ ! -z "$DNS_REC" ]
        then
            httpstatus 200
            echo "Cache-Control: private, max-age=$DNS_TTL"
            ANSWER="$DNS_REC"
        else
            httpstatus 404
            ANSWER="NOERROR, but no $DNS_TYPE record"
        fi
        ;;
    "NXDOMAIN")
        httpstatus 404
        ANSWER="$DNS_STATUS"
        ;;
esac

echo "Content-Type: text/plain"
echo
echo "$ANSWER"

With the following
#nginx directives too assuming you got a #fastcgi set up already:
upstream dohexperiment {
    server 127.0.0.1:80;
}

[...]

location ~ /dns/(.*)/(.*)$ {
        proxy_pass http://dohexperiment/dns/index.cgi?domain=$1&type=$2;
}
location ~ /dns/(.*[^\/])$ {
        proxy_pass http://dohexperiment/dns/index.cgi?domain=$1;
}

#DNS #HTTP #REST

RE:
https://makai.chaotic.ninja/notes/9vyxx3nwty

2024-06-24

Установка и настройка phpMyAdmin: пошаговая инструкция

phpMyAdmin — это специальная утилита, написанная на PHP, которая реализует графический интерфейс для управления базами данных MySQL через браузер. Помимо визуального отображения таблиц, phpMyAdmin упрощает менеджмент баз данных, позволяя формировать SQL-запросы через панель управления без непосредственного написания команд или какого-либо кода. При этом phpMyAdmin реализует весь функционал SQL-запросов: просмотр, добавление, удаление и изменение баз данных, а также их таблиц, полей и индексов. В этом руководстве мы рассмотрим процесс установки phpMyAdmin и всех его зависимостей на удаленный хост. В показанных примерах используется облачный сервер Timeweb Cloud под управлением Ubuntu 22.04.

habr.com/ru/companies/timeweb/

#timeweb_статьи #phpMyAdmin #SQL #MySQL #PHP #Ubuntu #Nginx #FastCGI #Windows #SSH #БД #Cloud #MongoDB #html #веб #хост #FPM #HTTP

vintage screwlisp accountscrewtape@mastodon.sdf.org
2024-01-04

@nytpu in your quest, consider #openBSD #slowCgi #fastCgi

2023-12-07

I think others have had similar problems that I ran into: configuring #httpd as a #fastcgi proxy. Scratching my head about getting more detailed #logs

2023-09-06

Needed a dynamic status page on some #embedded #pcengines #netbsd boxes, so thought I'd see if a #perl #nginx #fastcgi #daemon (with a pidfile & 'start', 'stop', status' etc) was quick to setup

Turns out: "yes"

#!/usr/pkg/bin/perl
use Daemon::Generic;
use CGI::Fast
socket_path => '127.0.0.1:8999',
listen_queue => 50;

newdaemon( 'progname' => 'statusd');

sub gd_run {
while ( $q = CGI::Fast->new ) {
process_request($q);
}
}

process_request() {
my $q = shift;
# code here
}

2023-07-21

"FastCGI sent in stderr: "fatal: unable to access '/var/lib/gitolite3/repositories/blog.uvokchee.de.git/config': Permission denied""

ughghghghgh... I don't wanna change chgrp the repos, I don't even think this is necessary.

www-data is already part of the gitolite3 group and *should* be able to access the repo. I can even access the config file when I'm on shell as www-data. I also already restarted nginx.

Does fastcgi run as yet another user?

#nginx #fastcgi

2023-05-18

@vandys @randomgeek @codinghorror As a #Perl hacker I will never besmirch #CGI as a standard or for light-use web scripts, but a lot of sins were committed with the two.

These days the done thing is to use #PSGI and a framework like #Mojolicious or #Dancer2 in a persistent app server. You don’t have to write nearly as much code, either. plackperl.org

The #Plack middleware can even run your code as a CGI or #FastCGI script if you reallly want.

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst