首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Apache SSL不工作

问Apache SSL不工作
EN

Stack Overflow用户
提问于 2013-05-19 23:34:39
回答 1查看 346关注 0票数 0
  • 基于debian的Linux上的Apache2.2
  • # a2enmod ssl && service apache2 restart
  • 根据SheildsUP,443端口已经关闭!扫描,但不是在隐形模式下
  • 根据netstat -nutlp,Apache正在监听端口80和443。
  • 在端口80和端口443托管相同的网站
  • http://website.com工作,https://website.com不工作

我的虚拟主机设置如下:

代码语言:javascript
复制
<VirtualHost *:443>
    SSLEngine               On
    SSLCertificateKeyFile   SSL_DIR/ssl.key
    SSLCertificateFile      SSL_DIR/ssl.crt
</VirtualHost>

<VirtualHost *:80 *:443>
    ServerAdmin     webmaster@localhost
    ServerAlias     website.com *.website.com
    ServerName      www.website.com

    # Just a few connection resets so that I don't waste my bandwidth on "hackers"
    SecRuleEngine On
    SecRule &REQUEST_HEADERS:User-Agent     "@eq 0"         drop,phase:1
    SecRule REQUEST_HEADERS:User-Agent      "^$"            drop,phase:1

    SecRule REQUEST_LINE                    "://"           drop,phase:1

    SecRule REQUEST_URI                     "^/admin"       drop,phase:1
    SecRule REQUEST_URI                     "^/mail"        drop,phase:1
    SecRule REQUEST_URI                     "^/webmail"     drop,phase:1

    DocumentRoot /path/public_html
    <Directory /path/public_html/>
            Options FollowSymLinks MultiViews
            Order allow,deny
            allow from all
    </Directory>
</VirtualHost>

当我注册我的SSL证书时,我也得到了两个.pem文件,并且找不到如何处理它们的任何东西。

我的问题是,为什么SSL不起作用?它与.pem文件有关吗?

EN

回答 1

Stack Overflow用户

发布于 2013-05-19 23:38:52

首先,必须启用ssl。

代码语言:javascript
复制
sudo a2enmod ssl

而不是你必须包括你的pem文件(迷你例子)

代码语言:javascript
复制
<VirtualHost *:443>
        SSLEngine               On
        SSLCertificateKeyFile   SSL_DIR/ssl.key
        SSLCertificateFile      SSL_DIR/ssl.crt

        ServerAdmin     webmaster@localhost
        ServerAlias     website.com *.website.com
        ServerName      www.website.com

        # Just a few connection resets so that I don't waste my bandwidth on "hackers"
        SecRuleEngine On
        SecRule &REQUEST_HEADERS:User-Agent     "@eq 0"         drop,phase:1
        SecRule REQUEST_HEADERS:User-Agent      "^$"            drop,phase:1

        SecRule REQUEST_LINE                    "://"           drop,phase:1

        SecRule REQUEST_URI                     "^/admin"       drop,phase:1
        SecRule REQUEST_URI                     "^/mail"        drop,phase:1
        SecRule REQUEST_URI                     "^/webmail"     drop,phase:1

        DocumentRoot /path/public_html
        <Directory /path/public_html/>
                Options FollowSymLinks MultiViews
                Order allow,deny
                allow from all
        </Directory>
    </VirtualHost>

    <VirtualHost *:80>
        ServerAdmin     webmaster@localhost
        ServerAlias     website.com *.website.com
        ServerName      www.website.com

        # Just a few connection resets so that I don't waste my bandwidth on "hackers"
        SecRuleEngine On
        SecRule &REQUEST_HEADERS:User-Agent     "@eq 0"         drop,phase:1
        SecRule REQUEST_HEADERS:User-Agent      "^$"            drop,phase:1

        SecRule REQUEST_LINE                    "://"           drop,phase:1

        SecRule REQUEST_URI                     "^/admin"       drop,phase:1
        SecRule REQUEST_URI                     "^/mail"        drop,phase:1
        SecRule REQUEST_URI                     "^/webmail"     drop,phase:1

        DocumentRoot /path/public_html
        <Directory /path/public_html/>
                Options FollowSymLinks MultiViews
                Order allow,deny
                allow from all
        </Directory>
    </VirtualHost>
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16640606

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档