如何使用Nginx将HTTP转换为HTTPS到本地服务器(自签名证书) [英] How to convert http to https using nginx for local server(self signed cetificate)

查看:101
本文介绍了如何使用Nginx将HTTP转换为HTTPS到本地服务器(自签名证书)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在nginx中将http转换为https(安全),为此我创建了nginx conf文件并将其添加到自签名证书中.

I am trying to convert http to https (secure) inside nginx, for that purpose I created and add self signed certificate inside nginx conf file.

server {
   listen 80;
   server_name www.local.com;
   rewrite        ^ https://$server_name$request_uri? permanent;
}
server {
   listen  443;
   server_name www.local.com;
   ssl on;
   ssl_certificate /etc/ssl/self_signed_certificate.crt;
   ssl_certificate_key /etc/ssl/self_signed_certificate.key;
}

现在,当我提供url时,它会从http重定向到https.并向我展示crome中的消息站点安全证书不可信.!".当我单击继续时.我收到"SSL连接"错误.它在http上完美工作.如何使用https运行我的本地网站.

Now, When I give url, it redirects from http to https. and show me messeage in crome "The site security certificate is not Trusted.! ". When I clicked on Proceed anyway. I got "SSL Connection" Error. Its working perfectly on http. How to run my local website using https.

我正在使用uwsgi服务器,并且网站位于python-Django中.我犯了什么错误或必须要做的其他事情?请帮忙.预先感谢(对不起,我的英语).

I am using uwsgi server and website is in python - Django. What mistake I did or something else I have to do ? Please Help. Thanks in advance (Sorry for my english).

推荐答案

您收到此消息是因为您使用的是自签名证书,因此需要使用来自受信任的提供程序的SSL证书来避免该警告.您可以在 StartSSL 上获得大多数主流浏览器信任的免费SSL证书.您可以在此处看到所有受支持的浏览器.

You are getting the message because you are using a self signed certificate, you need to use a SSL certificate from a trusted provider to avoid the warning. You can get a free SSL cert that is trusted by most major browsers at StartSSL. You can see all of the browsers that are supported here.

这篇关于如何使用Nginx将HTTP转换为HTTPS到本地服务器(自签名证书)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆