运行 ./launcher rebuild app 后出现以下错误:
Did not find expected key while parsing block mapping at line 10 column 1 -e LANG-en_US.UTF8.
YAML syntax error
我在 app.yml 文件的 “after_code:” 之后添加了以下内容:
after_web_config:
- replace:
filename: /etc/nginx/nginx.conf
from: /sendfile.+on;/
to: |
server_names_hash_bucket_size 64;
sendfile on;
- file:
path: /etc/nginx/conf.d/discourse_redirect_1.conf
contents: |
server {
listen 80;
server_name old-domain.com;
return 301 $scheme://new-domain.com$request_uri;
}
after_ssl:
- replace:
filename: "/etc/runit/1.d/letsencrypt"
from: /--keylength/
to: "-d old-domain.com -d new-domain.com --keylength"
我的目标是将旧域名通过 301 重定向到新域名,同时让 LetsEncrypt 继续为旧域名更新证书。被编辑的 .yml 文件位于“旧域名”服务器上。
“old-domain.com” 和 “new-domain.com” 仅为占位符,并非真实网址。