- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
问题
我正在尝试在 Elastic Beanstalk 中的 EC2 实例上启用 HTTPS。我在 .ebextensions
目录中有一个 https-instance.config
文件,其中包括停止和启动 httpd
服务器。原始容器命令是这些(来自 AWS 文档 here ,并且在我的问题中也提到了 here :
container_commands:
01killhttpd:
command: "killall httpd"
02waitforhttpddeath:
command: "sleep 3"
但是,我收到以下错误,详细信息在 cfn-init.log
中:
2020-08-25 14:51:55,622 [INFO] -----------------------Starting build-----------------------
2020-08-25 14:51:55,631 [INFO] Running configSets: Infra-EmbeddedPostBuild
2020-08-25 14:51:55,634 [INFO] Running configSet Infra-EmbeddedPostBuild
2020-08-25 14:51:55,638 [INFO] Running config postbuild_0_tiny_app
2020-08-25 14:51:55,706 [ERROR] Command 01killhttpd (systemctl restart httpd.service) failed
2020-08-25 14:51:55,706 [ERROR] Error encountered during build of postbuild_0_tiny_app: Command 01killhttpd failed
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 542, in run_config
CloudFormationCarpenter(config, self._auth_config).build(worklog)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 260, in build
changes['commands'] = CommandTool().apply(self._config.commands)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/command_tool.py", line 117, in apply
raise ToolError(u"Command %s failed" % name)
ToolError: Command 01killhttpd failed
2020-08-25 14:51:55,706 [ERROR] -----------------------BUILD FAILED!------------------------
2020-08-25 14:51:55,707 [ERROR] Unhandled exception during build: Command 01killhttpd failed
Traceback (most recent call last):
File "/opt/aws/bin/cfn-init", line 171, in <module>
worklog.build(metadata, configSets)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 129, in build
Contractor(metadata).build(configSets, self)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 530, in build
self.run_config(config, worklog)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 542, in run_config
CloudFormationCarpenter(config, self._auth_config).build(worklog)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 260, in build
changes['commands'] = CommandTool().apply(self._config.commands)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/command_tool.py", line 117, in apply
raise ToolError(u"Command %s failed" % name)
ToolError: Command 01killhttpd failed
我已尝试从 https-instance.config
中删除此重新启动,它会构建但无法连接到 HTTPS。我还尝试用其他命令替换上述命令以重新启动 httpd
服务器,但这些命令导致的错误与上面的错误几乎相同:
container_commands:
01restart:
command: "systemctl restart httpd"
和
container_commands:
01restartservice:
command: "systemctl restart httpd.service"
问题
如何重新启动 httpd 服务器以允许 HTTPS 连接到我的应用程序?
上下文
这是我从 AWS 获得的完整 https-instance.config
:
packages:
yum:
mod_ssl : []
files:
/etc/httpd/conf.d/ssl.conf:
mode: "000644"
owner: root
group: root
content: |
LoadModule wsgi_module modules/mod_wsgi.so
WSGIPythonHome /opt/python/run/baselinenv
WSGISocketPrefix run/wsgi
WSGIRestrictEmbedded On
Listen 443
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile "/etc/pki/tls/certs/server.crt"
SSLCertificateKeyFile "/etc/pki/tls/certs/server.key"
Alias /static/ /opt/python/current/app/static/
<Directory /opt/python/current/app/static>
Order allow,deny
Allow from all
</Directory>
WSGIScriptAlias / /opt/python/current/app/application.py
<Directory /opt/python/current/app>
Require all granted
</Directory>
WSGIDaemonProcess wsgi-ssl processes=1 threads=15 display-name=%{GROUP} \
python-path=/opt/python/current/app \
python-home=/opt/python/run/venv \
home=/opt/python/current/app \
user=wsgi \
group=wsgi
WSGIProcessGroup wsgi-ssl
</VirtualHost>
/etc/pki/tls/certs/server.crt:
mode: "000400"
owner: root
group: root
content: |
-----BEGIN CERTIFICATE-----
MIID8zCCAtsCFGzyKrXOsCiyLHRPfBG75SlmQyXqMA0GCSqGSIb3DQEBCwUAMIG1
...
PuulTMAZWNXHa0g+XbRTtOQDA8FA0vlA80B+rFUQESSo2Cw5JKXTaL9OpMMG/t9S
qvv+vGuaIw==
-----END CERTIFICATE-----
/etc/pki/tls/certs/server.key:
mode: "000400"
owner: root
group: root
content: |
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEA+OYzho7mXLUY6zTTqBIibsk2rfuJIO2xN2moIUNTqzJS8Yv6
...
cSQsBzRR1Z5hl77Qa6gwiDx7rYswWtQt/8zsY8OUB3kg1SqriwI=
-----END RSA PRIVATE KEY-----
container_commands:
01restartservice:
command: "systemctl restart httpd.service"
最佳答案
您的命令失败的原因是在 Amazon Linux 2 上Python 3.7 环境没有没有httpd(它是物理安装的,但不是事件的)。您可以通过 sshing 进入实例并运行来验证这一点:
sudo systemctl status httpd
相反,there are nginx
和 gunicorn
作为 wsgi。您提供的 AWS 文档链接适用于 Amazon Linux 1,而不是 2。
因此,应该使用 nginx 设置 SSL 证书和 HTTPs config files在 .platform/nginx/conf.d/
文件夹中。
关于ssl - 如何重启 httpd 以在 Elastic Beanstalk 中的 EC2 实例上启用 HTTPS?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63581996/
我正在研究PyroCMS的Docker版本。这是我拥有最新文件的repository。如您所见,我正在运行一个堆栈:CentOS 7(带有Supervisord),MySQL,Apache和PHP。这
为了避免对我本地托管的 apache-tomcat Web 服务器上托管的 Web 应用程序进行点击劫持攻击,我正在尝试编辑“httpd.conf”文件以向其附加 X 选项。 用“sudo nano/
更改 httpd.conf 文件后是否需要重新启动 httpd 才能使更改生效? 最佳答案 是的。 HTTPD.conf 是在 apache 启动时读取的,因此要使任何更改生效,您都需要重新启动它。
我的 CentOS7 服务器上有一个 Laravel 项目,位于文件夹“/var/www/html/myProject”中。 我已将“DocumentRoot”和配置目录中的/etc/httpd/co
我在别人的 linux 服务器上(共享主机)。我没有root访问权限。我已经确定它是一个 Redhat 4.1.2-46,以 Centos Release 5.9(Final) 的形式运行。 我有该站
我需要使用/etc/init.d/httpd status 命令来验证它是否在 shell 中运行。我不想使用 pidof pgrep 等——类似 retval=`/etc/init.d/httpd
我已经下载了 httpd-2.4.16.tar.gz 来自 http://www.apache.org/dist/httpd/ 的包裹 并在我的 ubuntu 14.04 LTS 上提取了两次,但我找
我正在使用免费套餐 Amazon AWS EC2 微型实例并托管一个 Wordpress 网站。由于内存太低,我总是会出现“Error Establishing to Database”之类的常见错误
当我启动我的centOS 服务器时。它通过我的错误如下所示。 启动 httpd: (20)Not a directory: httpd: 无法打开错误日志文件/etc/httpd/logs/error
有谁知道什么会导致 Apache 的错误日志中出现此错误(特别是在 Arch Linux 中): PID file /run/httpd/httpd.pid not readable (yet?) a
我设置了 AWS EC2(Windows Server 2012 R2 Base),允许入站 RDP、HTTP 和 HTTPS,并安装了 Wampserver 以及来自 Microsoft 的 64
当我想在centOS 6.7 上重启httpd 服务时出现以下错误: /etc/init.d/httpd restart Stopping httpd:
x-httpd-php5x 和 application/x-httpd-php5x 有什么区别? 多年来,我一直在使用 application/x-httpd-php 和我的网络托管 (Linux),
我已将 apache httpd 服务器从 2.4.6 升级到 2.4.46。 当我触发 systemctl start httpd 时,它显示以下错误: Starting httpd: /usr/s
我有一个 tomcat,监听 8080 端口,还有一个 apache httpd 监听 80 和 443 端口。 The httpd proxies the client through to tom
我安装了 Centos 7 的新副本。然后我重新启动了 Apache,但 Apache 无法启动。我在这个问题上停留了 3 天。连支持都想不通这个错误。 sudo service httpd star
我最近开始升级我的httpd版本 2.2 从带有 RHEL 4 的旧服务器到附带 httpd 的 RHEL 7 2.4 版。 我注意到的变化之一是 conf.modules.d 包含以下文件的目录:
我在我的linux中使用php7.1: 我可以检查一下: # php -v PHP 7.1.16 (cli) (built: Jun 25 2018 08:12:28) ( ZTS ) 因此在我的 h
我正在使用一个使用 Smarty 模板引擎的框架。它在 Windows 中运行良好,但当我尝试在 LAMP 服务器中运行它时,我收到一条消息,如 SELinux 在您的系统上检测到可疑行为。我附上了整
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a software
我是一名优秀的程序员,十分优秀!