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.
@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
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
https://sans-io.readthedocs.io/
#fastcgi was #cloudfunctions before it was cool. #changemymind #tech #development #web
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
nginx + AWStats
AWStats 是個很老牌的分析工具,直接對 access log 分析後提供報表,本來以為是完全沒在動的專案,但從版本記錄發現 2020 年與 2023 年各有一版修安全性問題,看起來還是有在維護?
會想到要裝是因為這幾天被砍站,CPU credit 低到觸發我設定的 alarm:
除了處理外,也想快速看一下發生什麼事情,而這種砍站的在 JavaScript 類的分析服務上不會看到,需要直接對 server log 分析,所以就想到 AWStats 了...
Ubuntu 可以透過 sudo apt install -y awstats
https://blog.gslin.org/archives/2024/08/01/11918/nginx-awstats/
Man, if #DNSoverHTTPS is just this simple...
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"
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;
}
Установка и настройка phpMyAdmin: пошаговая инструкция
phpMyAdmin — это специальная утилита, написанная на PHP, которая реализует графический интерфейс для управления базами данных MySQL через браузер. Помимо визуального отображения таблиц, phpMyAdmin упрощает менеджмент баз данных, позволяя формировать SQL-запросы через панель управления без непосредственного написания команд или какого-либо кода. При этом phpMyAdmin реализует весь функционал SQL-запросов: просмотр, добавление, удаление и изменение баз данных, а также их таблиц, полей и индексов. В этом руководстве мы рассмотрим процесс установки phpMyAdmin и всех его зависимостей на удаленный хост. В показанных примерах используется облачный сервер Timeweb Cloud под управлением Ubuntu 22.04.
Is there a way under #WordPress using #Nginx and #FastCGI caching to *not* cache the front page of the blog? My sidebar widgets are basically all out of sync because the front page is cached.
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?
@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. https://plackperl.org
The #Plack middleware can even run your code as a CGI or #FastCGI script if you reallly want.
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.
ELI10 What the heck is #FastCGI
@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.
@simon @js @berkes I have fond memories of a bespoke #FastCGI CRUD app I made in the mid-2000s. I got to choose every single component down to the bug tracker because I was a dev team of one, but I made sure there was both a stack and a process I could hand off so I could walk away when the project was over.