【问题标题】:How to remove the self-signed SSL certificate created in AWS ubuntu server如何删除在 AWS ubuntu 服务器中创建的自签名 SSL 证书
【发布时间】:2018-06-30 07:26:24
【问题描述】:

您好,我已经在 AWS ubuntu 服务器中部署了一个简单的烧瓶 python web,遵循了这个家伙的电子书 (https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-vii-error-handling)。但是我发现有问题,当我想通过浏览器访问网络时。 当我在chrome浏览器中访问该站点时,出现如图所示的安全警告。虽然我可以单击“处理到...”以成功访问该站点。

但我不希望在访问该站点时显示警告图像。

我发现这个问题是由 AWS ubuntu 服务器中的自签名 SSL 证书引起的。创建 SSL 证书的命令如下:

 $ mkdir certs
 $ openssl req -new -newkey rsa:4096 -days 365 -nodes -x509 \
  -keyout certs/key.pem -out certs/cert.pem

Nginx 配置如下,我想删除或注释掉 ssl_certificate 部分,然后重新加载。但是我发现我无法访问该网站。 在我添加了 ssl_certificate 部分之后,它就可以工作了。但是仍然有警告页面。 如何处理这个问题。

    server {
    # listen on port 443 (https)
    listen 443 ssl;
    server_name _;
    # location of the self-signed SSL certificate
    ssl_certificate /home/ubuntu/microblog2/certs/cert.pem;
    ssl_certificate_key /home/ubuntu/microblog2/certs/key.pem;

    location / {
        # forward application requests to the gunicorn server
        proxy_pass http://127.0.0.1:8000;
        proxy_redirect off;
        proxy_set_header Host \$host;
        proxy_set_header X-Real-IP \$remote_addr;
        proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
}
    location /static {
        # handle static files directly, without forwarding to the application
        alias /home/ubuntu/microblog2/static;
        expires 30d;
} }

【问题讨论】:

    标签: python amazon-web-services ubuntu ssl nginx


    【解决方案1】:

    为了从您的设置中删除证书,您需要在不支持 SSL 的情况下将配置返回到端口 80。所以删除 listen 443 ssl ssl_certificate 行,并且只替换为 listen 80

    获得正确的证书后,您可以在上传配置中显示的证书文件后返回此配置。

    【讨论】:

    • 感谢您的回答。我已经用listen 80替换了listen 443 ssl。虽然我可以访问该站点。但有时当我单击站点项目时,它会返回到(https//180 ....)。并错误地重新加载页面。
    猜你喜欢
    • 1970-01-01
    • 2020-12-17
    • 2018-09-18
    • 2010-11-13
    • 1970-01-01
    • 2014-10-08
    • 2011-06-11
    • 2011-09-28
    • 2017-07-21
    相关资源
    最近更新 更多