Nginx使用备忘

安装和更新 安装 以ArchLinux为例 yay -S nginx 生成的systemctl单元如下 [Unit] Description=A high performance web server and a reverse proxy server After=network.target network-online.target nss-lookup.target [Service] Type=forking PIDFile=/run/nginx.pid PrivateDevices=yes SyslogLevel=err ExecStart=/usr/bin/nginx -g 'pid /run/nginx.pid; error_log stderr;' ExecReload=/usr/bin/nginx -s reload KillMode=mixed [Install] WantedBy=multi-user.target 更新 查看现有Nginx的编译参数 ➜ ~ nginx -V nginx version: nginx/1.22.1 built with OpenSSL 3.0.7 1 Nov 2022 (running with OpenSSL 3.0.8 7 Feb 2023) TLS SNI support enabled configure arguments: --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/bin/nginx --pid-path=/run/nginx....

June 21, 2023 · 2 min · czyt

Golang Web框架Buffalo 简单使用

官方文档 https://gobuffalo.io 安装 安装要求 Before installing make sure you have the required dependencies installed: A working Go environment Go version v1.16.0. Frontend Requirements# The following requirements are optional. You don’t need them if you want to build an API or if you prefer to build your app in an old-fashioned way. node version 8 or greater either yarn or npm for the asset pipeline built upon webpack. Database Specific Requirements# Again, if you don’t need a database, you won’t need these....

January 29, 2023 · 1 min · czyt

golang webserver with genergic base64 /favicon.ico

package main import ( "fmt" "net/http" ) func main() { http.HandleFunc("/favicon.ico", favicon) http.HandleFunc("/", hello) fmt.Printf("listening on http://localhost:8000/\n") http.ListenAndServe("localhost:8000", nil) } func favicon(w http.ResponseWriter, r *http.Request) { fmt.Printf("%s\n", r.RequestURI) w.Header().Set("Content-Type", "image/x-icon") w.Header().Set("Cache-Control", "public, max-age=7776000") fmt.Fprintln(w, "data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQEAYAAABPYyMiAAAABmJLR0T///////8JWPfcAAAACXBIWXMAAABIAAAASABGyWs+AAAAF0lEQVRIx2NgGAWjYBSMglEwCkbBSAcACBAAAeaR9cIAAAAASUVORK5CYII=\n") } func hello(w http.ResponseWriter, r *http.Request) { fmt.Printf("%s\n", r.RequestURI) fmt.Fprintln(w, "Hello, World!") }

February 23, 2022 · 1 min · czyt