Django和SSL问题 [英] Django and SSL question

查看:171
本文介绍了Django和SSL问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我计划通过收取信用卡来销售产品,因此使用SSL对于Django供电的网站至关重要。我的初始django安装计划正在使用Apache作为Web服务器,并使用mod_wsgi与Django进行通信,Apache再次服务于静态媒体。



所有这些都似乎很好,直到SSL协议达到计划。



我将使用SSL协议进行用户帐户配置页面,整个采购顺序,也可能在django管理员。 / p>

我已经检查了官方的文档和谷歌搜索,但答案令人困惑。




  • 对此设置实施SSL的推荐方法是什么?

  • 这是SSL实施者到网站的第一次建议?

  • 此页面,它似乎已经将Nginx包含在堆栈中。没有它可以做到吗?



谢谢

解决方案

我已经使用Apache的 mod_ssl mod_wsgi 在SSL上部署了Django应用程序。 >

我不是Apache专家,但是这里是如何为一个站点设置SSL(将下面的指令放在 httpd.conf 文件或从该文件引用的文件中,例如在启用站点的目录中(如果在Apache安装中使用)。请参阅下面的第一个文档链接,了解如何创建和使用自签名证书。

  NameVirtualHost *:443 
< VirtualHost *:443>
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/certificatefile.crt
SSLCertificateKeyFile /etc/apache2/ssl/certificatekeyfile.crt

WSGIScriptAlias / / path / to /file.wsgi
< / VirtualHost>

文档链接:




I am planning to sell products by charging credit cards thus using SSL will be critical for Django-powered website. And I am very naive for this.

My initial django setup plan was using Apache as the webserver and using mod_wsgi to communicate with Django, static media again served by Apache. All seemed good until SSL protocol comes to the plans.

I will be using SSL protocol for user account configuration pages, the whole purchase sequence and maybe at the django admin.

I have checked the official documentations and googled but answers are rather confusing.

  • What would be the recommended way of implementing SSL to this setup ?
  • Any suggestions to this first time SSL implementer to a website ?
  • From this page, it seems like they have included Nginx to the stack. Couldn't it be done without it ?

Thanks

解决方案

I have deployed Django apps on SSL using Apache's mod_ssl and mod_wsgi.

I am no Apache expert, but here's how I setup SSL for one site (put the directives below in the httpd.conf file, or in a file referenced from that file, for instance in the sites-enabled directory, if that is used in your Apache installation). See the first documentation link below for how to create and use a self-signed certificate.

NameVirtualHost *:443
<VirtualHost *:443>
    SSLEngine On
    SSLCertificateFile /etc/apache2/ssl/certificatefile.crt
    SSLCertificateKeyFile /etc/apache2/ssl/certificatekeyfile.crt

    WSGIScriptAlias / /path/to/file.wsgi
</VirtualHost>

Documentation links:

这篇关于Django和SSL问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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