服务器搭建记录
LLM 让基础知识的记录变得有些鸡肋,但对于定制化的复杂环境搭建,还是记录下来比较好,省得以后再研究一遍。 服务器 选服务器:地点、价格、备份;vultr $6/m 本地配置快速 ssh 连接:.ssh/config Host vultr HostName xx.xx.xx.xx User root Port xx 修改 ssh 端口:/etc/ssh/sshd_config Port 复制本地公钥到 authorized_keys ufw enable $new_port; ufw disable $old_port 搞个域名 cloudflare DNS A @ A www DNS 设置:启用 DNSSEC 及多重签名 开启电子邮件路由转发和 DMARC,免得自己维护邮件服务器 SSL/TLS 改为 Full Strict,并生成源服务器证书 外部访问网站时用 cloudflare 自带的证书,cloudflare 访问源服务器时用它生成的证书 这样省得管理外部证书,且内部证书有效期 15 年 hugo 修改 /etc/network/interfaces.d/50-cloud-init 中的 dns-nameservers 为 8.8.8.8 1.1.1.1 apt update; apt install golang git useradd -m -s /bin/zsh username; usermod -aG sudo username /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" brew install sass/sass/sass hugo hugo new site WhiteDew --format yaml cd WhiteDew # git init # git submodule add --depth=1 https://github.com/adityatelange/hugo-PaperMod.git themes/PaperMod # git submodule update --init --recursive # reclone 时需要,submodules 可能不会自动 clone hugo new --kind post content/posts/vps_setup.cn.md hugo --cleanDestinationDir server --buildDrafts 图片处理 brew install imagemagick mogrify -strip -format webp -quality 70 *b.JPG xattr -rc *.webp nginx hugo cp -r public /var/www/whitedew apt install nginx emacs /etc/nginx/sites-available/whitedew server { listen 443 ssl default_server; ssl_certificate /root/bailu.dev.pem; ssl_certificate_key /root/bailu.dev.key; root /var/www/whitedew; index index.html; server_name bailu.dev www.bailu.dev; location / { try_files $uri $uri/ =404; } } ln -s /etc/nginx/sites-available/whitedew /etc/nginx/sites-enabled/ nginx -t nginx -s reload systemctl status nginx ufw allow 'Nginx HTTPS'