fosstodon.org is one of the many independent Mastodon servers you can use to participate in the fediverse.
Fosstodon is an invite only Mastodon instance that is open to those who are interested in technology; particularly free & open source software. If you wish to join, contact us for an invite.

Administered by:

Server stats:

9.8K
active users

#fastcgi

0 posts0 participants0 posts today

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
Replied in thread

@gtsteel @philgyford are there ways to deploy applications developed with newer languages like over ? 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

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

gmid.omarpolo.comhome | gmid
Replied in thread
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!
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...
GitHubGitHub - FastCGI-Archives/fcgi2: FastCGI.com fcgi2 Development Kit fork from http://repo.or.cz/fcgi2.git + last snapshotFastCGI.com fcgi2 Development Kit fork from http://repo.or.cz/fcgi2.git + last snapshot - FastCGI-Archives/fcgi2

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

Gea-Suan Lin's BLOG · nginx + AWStatsAWStats 是個很老牌的分析工具,直接對 access log 分析後提供報表,本來以為是完全沒在動的專案,但從版本記錄發現 2020 年與 2023 年各有一版修安全性問題,看起來還是有在維護? 會想到要裝是因為這幾天被砍站,CPU credit 低到觸發我設定的 alarm: 除了處理外,也想快速看一下發生什麼事情,而這種砍站的在 JavaScript 類的分析服務上不會看...

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

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

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

habr.com/ru/companies/timeweb/

ХабрУстановка и настройка phpMyAdmin: пошаговая инструкцияphpMyAdmin — это специальная утилита, написанная на PHP, которая реализует графический интерфейс для управления базами данных MySQL через браузер. Помимо визуального отображения таблиц, phpMyAdmin...

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
}

"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?

Replied in thread

@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.

plackperl.orgPSGI/Plack - Perl Superglue for Web Frameworks and Web Servers

Wat fijn, zeg. Nginx, FastCGI en DNS zijn geen vrienden op de webserver. Ze praten wat slecht met elkaar, als in de één is wat later opgestart (DNS), waardoor dat de anderen hem niet zien en er als resultaat telkens een 502 Bad Gateway te zien is. Grmbl. In plaats van te schilderen, mag ik nu gaan probleem-oplossen en zien of het fatsoenlijk kan draaien.

Replied in thread

@freyfogle #CGI’s bad rap came not from its programming model, but from its execution model of spawning a new process apart from the web server for every request. #FastCGI mitigated that by spinning up a separate persistent server that handles requests over and over again without forking, communicating with the web server over a socket, pipe, or TCP. It’s the same model as any other web application server.