app.yml 文件更新问题

运行 ./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” 仅为占位符,并非真实网址。

相关建议可参考 此处此处

1 个赞

是的,这是一个 YAML 错误。它可能出现在文件的任何位置。网上有各种 YAML 检查工具。一个解决方案是将整个文件粘贴到其中一个工具中进行检查。

4 个赞

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.