以非交互方式启动 apache HTTPD Web 服务器

以非交互方式启动 apache HTTPD Web 服务器

我希望以非交互方式提供启动 apache httpd Web 服务器时提示的密码。

密码将是一个变量。

我不需要手动提示和输入密码,如下所示:

/web/apps/perf/apache/2.4.46/https-model/bin/apachectl -k start
Apache/2.4.46 mod_ssl (Pass Phrase Dialog)
Some of your private key files are encrypted for security reasons.
In order to read them you have to provide the pass phrases.

Private key model.com:443:0 (/web/apps/perf/apache/2.4.46/https-model/ssl/model.key)
Enter pass phrase:

我尝试了以下选项,但没有一个有帮助。

echo -n "mypassword" | /web/apps/perf/apache/2.4.46/https-model/bin/apachectl -k start
echo "mypassword" >> /web/apps/perf/apache/2.4.46/https-model/bin/apachectl -k start
/web/apps/perf/apache/2.4.46/https-model/bin/apachectl -k start << echo "mypassword"
/web/apps/perf/apache/2.4.46/https-model/bin/apachectl -k start << cat mypasswordfile (where mypasswordfile is a file having the password.)

你能建议一下吗?

答案1

您的 SSL 证书私钥似乎受密码保护。通常,最好、最简单的方法是从密钥中删除密码。

openssl rsa -in [original.key] -out [new.key]

系统将提示您输入密钥的密码。运行后new.key就没有密码了。您可以替换它或将 Apache 指向“新”生成的密钥。

如果出于某种原因您想要为您的私钥设置密码,您可以使用此方法 -https://serverfault.com/a/160835

相关内容