Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
289 views
in Technique[技术] by (71.8m points)

python - How to convert http to https using nginx for local server(self signed cetificate)

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;
}

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.

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).

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...