SSL问题(Apache和Django)

时间:2012-09-18 05:49:31

标签: apache ssl

我似乎无法让SSL工作。我花了大约15个小时试图让我的网站使用HTTPS 我从Comodo获得了SSL证书。我跟着these directions

我首先尝试在ssl.conf中编辑正确的字段,但最后我只是在httpd.conf中添加了另一个虚拟主机。但是,无论哪种方式都不允许我使用https访问我的网站。

我的网站是foodchute.com。我不知道该怎么办,过去几天我一直在搞乱apache和ssl。任何帮助都会很棒。

附注:我的证书链文件是否需要进行PEM编码?我的链文件只包含4个证书。我查看了一些默认的链文件,我看到了一堆证书以及其他类似的信息:

Certificate:

Data:
    Version: 3 (0x2)
    Serial Number:
        61:8d:c7:86:3b:01:82:05
    Signature Algorithm: sha1WithRSAEncryption
    Issuer: CN=ACEDICOM Root, OU=PKI, O=EDICOM, C=ES
    Validity
        Not Before: Apr 18 16:24:22 2008 GMT
        Not After : Apr 13 16:24:22 2028 GMT
    Subject: CN=ACEDICOM Root, OU=PKI, O=EDICOM, C=ES
    Subject Public Key Info:
        Public Key Algorithm: rsaEncryption
            Public-Key: (4096 bit)
            Modulus:
                00:ff:92:95:e1:68:06:76:b4:2c:c8:58:48:ca:fd:
                80:54:29:55:63:24:ff:90:65:9b:10:75:7b:c3:6a:
                db:62:02:01:f2:18:86:b5:7c:5a:38:b1:e4:58:b9:
                fb:d3:d8:2d:9f:bd:32:37:bf:2c:15:6d:be:b5:f4:
                21:d2:13:91:d9:07:ad:01:05:d6:f3:bd:77:ce:5f:
                42:81:0a:f9:6a:e3:83:00:a8:2b:2e:55:13:63:81:
                ca:47:1c:7b:5c:16:57:7

这些是我的档案。 的httpd.conf

</VirtualHost>

<VirtualHost *:80>
    DocumentRoot /home/ec2-user/foodchute/foodchute
    ServerName www.foodchute.com
    #Redirect / https://23.23.93.154/
    ErrorLog /home/ec2-user/foodchute/foodchute/logs/apache_error.log
    CustomLog /home/ec2-user/foodchute/foodchute/logs/apache_access.log combined
    WSGIScriptAlias / /home/ec2-user/foodchute/foodchute/foodchute/wsgi.py

    <Directory /home/ec2-user/foodchute/foodchute/foodchute>
    <Files wsgi.py>
        Order deny,allow
        Allow from all
    </Files>
    </Directory>

    <Directory /home/ec2-user/foodchute/foodchute/images>
        Order deny,allow
        Allow from all
    </Directory>

    <Directory /home/ec2-user/foodchute/foodchute/foodchute>
        Order deny,allow
        Allow from all
    </Directory>

    #LogLevel warn

    #Alias /media/ /home/djangotest/helloworld/media

</VirtualHost>

<VirtualHost *:443>
    SSLEngine On
    SSLCertificateFile /etc/pki/tls/certs/foodchute.crt
    SSLCertificateKeyFile /etc/pki/tls/certs/foodchute.key
    SSLCertificateChainFile /etc/pki/tls/certs/foodchute.ca-bundle

    DocumentRoot /home/ec2-user/foodchute/foodchute
    ServerName www.foodchute.com
    #Redirect / https://23.23.93.154/
    ErrorLog /home/ec2-user/foodchute/foodchute/logs/apache_error.log
    CustomLog /home/ec2-user/foodchute/foodchute/logs/apache_access.log combined
    WSGIScriptAlias / /home/ec2-user/foodchute/foodchute/foodchute/wsgi.py

    <Directory /home/ec2-user/foodchute/foodchute/foodchute>
    <Files wsgi.py>
        Order deny,allow
        Allow from all
    </Files>
    </Directory>

    <Directory /home/ec2-user/foodchute/foodchute/images>
        Order deny,allow
        Allow from all
    </Directory>

    <Directory /home/ec2-user/foodchute/foodchute/foodchute>
        Order deny,allow
        Allow from all
    </Directory>

    #LogLevel warn

    #Alias /media/ /home/djangotest/helloworld/media

</VirtualHost>

WSGIPythonPath /home/ec2-user/foodchute/venv/lib/python2.6/site-packages

Alias /static/ /home/ec2-user/foodchute/venv/lib/python2.6/site-packages/django/contrib/admin/static/

wsgi.py

"""
WSGI config for foodchute project.

This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` setting.

Usually you will have the standard Django WSGI application here, but it also
might make sense to replace the whole Django WSGI application with a custom one
that later delegates to the Django one. For example, you could introduce WSGI
middleware here, or combine a Django application with an application of another
framework.

"""
import os,sys

apache_configuration = os.path.dirname(__file__)
project = os.path.dirname(apache_configuration)
workspace = os.path.dirname(project)
sys.path.append(workspace)
sys.path.append('/home/ec2-user/foodchute/foodchute')
sys.path.append('/home/ec2-user/foodchute')

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "foodchute.settings")

# This application object is used by any WSGI server configured to use this
# file. This includes Django's development server, if the WSGI_APPLICATION
# setting points here.
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

# Apply WSGI middleware here.
# from helloworld.wsgi import HelloWorldApplication
# application = HelloWorldApplication(application)

1 个答案:

答案 0 :(得分:0)

我修好了。我忘了为我的亚马逊ec2实例打开端口423 ......问题解决了。

相关问题