【发布时间】: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