2012-09-18 222 views
0

我似乎無法獲得SSL的工作。我花了15個小時試圖讓我的網站使用HTTPS。
我從Comodo獲得SSL證書。我跟着these directionsSSL(Apache和Django)的問題

我第一次嘗試在我的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) 

回答

0

我解決了這個問題。我忘了打開我的amazon ec2實例的端口423 ......問題解決了。