使用 CloudFlare API 实现动态 DNS

在ChatGPT的帮助下我有了以下脚本:

#/bin/bash
# 设置Cloudflare的API密钥、电子邮件地址和区域ID
api_key=""
email=""
zone_identifier=""
record_identifier=""

# 设置要更新的DNS记录的信息

record_name="aaa.example.com"
proxied=false
record_type="AAAA"
comment="IPv6 update"
#以IPv6为例
ipv6_address=""

curl --request PUT \
    --url "https://api.cloudflare.com/client/v4/zones/${zone_identifier}/dns_records/${record_identifier}" \
    --header 'Content-Type: application/json' \
    --header "X-Auth-Email: ${email}" \
    --header "X-Auth-Key: ${api_key}" \
    --data "{
    \"content\": \"${new_ipv6_address}\",
    \"name\": \"${record_name}\",
    \"proxied\": ${proxied},
    \"type\": \"${record_type}\",
    \"comment\": \"${comment}\"
}"

其中的空项大都可以通过登录CloudFlare查询到。需要注意的是record_identifier一项,它也需要通过api获取:

Nginx reverse proxy configure and something else

yoursite.com域名下的所有路径均反向代理到localhost:8080:

server {
        root /var/www/html;
    server_name yoursite.com;

    location / {
        proxy_pass http://localhost:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_redirect off;
    }
#ssl settings
}

将根路径代理到localhost:8080而将/web02代理到localhost:18080

Some Notes


Use TestDisk and PhotoRec to recover photos in SDXC card, and it works, perfectly.


Change the base url of in Nginx as follows:

    location /01/ {
        alias /var/www/01/;
        index index-01.html;

  • Mount a .iso file:
sudo modprobe loop
sudo mount ./something.iso ./mnt

sudo setfacl -m u:jellyfin:rx /home/user
sudo setfacl -x u:jellyfin /home/user

Basical usage of NTP service

Newly installed an openSUSE system on my ThinkPad X1 Tablet for daily use. BTW Windows runs as shit on it. I noticed that the time of system was incorrect. So...I'm trying solving it by deploying NTP service and run it manually once.

喜报:本站升级为HUGO站

那么简记一下配置过程吧。

不论如何,请首先参阅 官方文档


我的配置思路是:

  • Run nginx service at server side, and set the web root to a certain dictionary such as /var/www/blog/.

Nginx failed while connecting to upstream

當我使用 nginx 對 localhost:8080 进行反向代理时,收到 503 响应。检查 nginx error log,发现有:

[crit] 10000#0: *3 connect() to 127.0.0.1:8080 failed (13: Permission denied) while connecting to upstream, client: ***, server: ***, request: "GET /x/ HTTP/1.1", upstream: "http://127.0.0.1:8080/", host: "***"

经过检查,发现是 SELinux 策略阻止了 nginx 访问 上游接口。

Edit trusted_domains via nextcloud.occ

Nextcloud is installed via snapcraft.

snap run nextcloud.occ config:system:get trusted_domains 1

snap run nextcloud.occ config:system:delete trusted_domains

snap run nextcloud.occ config:system:set trusted_domains 1 --value=www.example.com

Deploy a WordPress Blog using Bitnami


Update
It seems that the linux .run file we were using in this article below is no longer provided by Bitnami. Sad...

WordPress usually requires a LAMP(Linux, Apache, MySQL, PHP) or LNMP environment, which is complicated to deploy and migrate. Bitnami provides an easier way to accomplish the jobs above.

Install Nextcloud Server using snapcraft with Nginx reverse proxy and HTTPS enabled

Snap provides an approach to install Nextcloud easy and clean.

Prepare a domain name resolved to the IP address of your server.

#Debian\Ubuntu: 

#As super user:

apt install snapd

snap install nextcloud

#Enter your domain into browser and you'll see the welcome page, opreate as instruction.

nextcloud.enable-https lets-encrypt

#Operate as instruction.

#Done.

To set nextcloud port different than default: