apache - 无法在 Apache 中安装 SSL

标签 apache ubuntu tomcat ssl server

我的服务器是 Ubuntu,我正在运行 Apache2。我正在使用 apache 指向我在 tomcat 中加载的网络应用程序。下面是我的 000-default.conf 文件。

<VirtualHost *:*>
    ProxyPreserveHost On

    # Servers to proxy the connection, or;
    # List of application servers:
    # Usage:
    # ProxyPass / http://[IP Addr.]:[port]/
    # ProxyPassReverse / http://[IP Addr.]:[port]/
    # Example:
    ProxyPass / http://0.0.0.0:8080/
    ProxyPassReverse / http://0.0.0.0:8080/

    ServerName localhost
</VirtualHost>

<VirtualHost *:443>

    SSL Engine On

    # Set the path to SSL certificate
    # Usage: SSLCertificateFile /path/to/cert.pem
    SSLCertificateFile /etc/apache2/ssl/STAR_myglukose_com.crt

    # Servers to proxy the connection, or;
    # List of application servers:
    # Usage:
    # ProxyPass / http://[IP Addr.]:[port]/
    # ProxyPassReverse / http://[IP Addr.]:[port]/
    # Example:
    ProxyPass / http://0.0.0.0:8080/
    ProxyPassReverse / http://0.0.0.0:8080/

    # Or, balance the load:
    # ProxyPass / balancer://balancer_cluster_name

</VirtualHost>

我指向 Tomcat 没问题,但问题出在 SSL 上。为 443 创建虚拟主机后,我无法重新启动 apache。我收到一个错误。它要求我引用 journalct1 -xe。该文件如下。

Aug 01 16:45:20 ip-172-31-5-246 apache2[27556]:  * Starting Apache httpd web server apache2
Aug 01 16:45:20 ip-172-31-5-246 apache2[27556]:  *
Aug 01 16:45:20 ip-172-31-5-246 apache2[27556]:  * The apache2 configtest failed.
Aug 01 16:45:20 ip-172-31-5-246 apache2[27556]: Output of config test was:
Aug 01 16:45:20 ip-172-31-5-246 apache2[27556]: [Tue Aug 01 16:45:20.638254 2017] [proxy_html:notice] [pid 27567] AH01425: I18n support in mod_proxy_html requires mod_xml2enc. Without it, non-ASCII characters in proxied pages are likely to display incorrectly. it, n
Aug 01 16:45:20 ip-172-31-5-246 apache2[27556]: AH00526: Syntax error on line 19 of /etc/apache2/sites-enabled/000-default.conf:
Aug 01 16:45:20 ip-172-31-5-246 apache2[27556]: Invalid command 'SSL', perhaps misspelled or defined by a module not included in the server configuration
Aug 01 16:45:20 ip-172-31-5-246 apache2[27556]: Action 'configtest' failed.
Aug 01 16:45:20 ip-172-31-5-246 apache2[27556]: The Apache error log may have more information.
Aug 01 16:45:20 ip-172-31-5-246 systemd[1]: apache2.service: Control process exited, code=exited status=1
Aug 01 16:45:20 ip-172-31-5-246 sudo[27550]: pam_unix(sudo:session): session closed for user root
Aug 01 16:45:20 ip-172-31-5-246 systemd[1]: Failed to start LSB: Apache2 web server.
-- Subject: Unit apache2.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit apache2.service has failed.

我尝试了各种方法来解决这个问题,包括将 SSL Engine 编写为 SSLEngine,执行 sudo a2enmod ssl 等,但都是一样的出现错误。

我该如何解决这个问题?

最佳答案

报错信息明确指出了问题:

AH00526: Syntax error on line 19 of /etc/apache2/sites-enabled/000-default.conf:
Invalid command 'SSL', perhaps misspelled or defined by a module not included in the server configuration

要解决问题,请查看特定行:

SSL Engine On

并通过删除 SSL 和 Engine 之间的空格来修复它:

SSLEngine On

关于apache - 无法在 Apache 中安装 SSL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45443657/

相关文章:

apache - 无法配置 Apache2 以禁用 SSLv3

python - 无法解决 Flask 设置中的 mod_wsgi 异常

shell - linux 文件系统布局-partiton-fdisk

mysql - 将 Ruby on Rails 连接到现有 MySQL 数据库(之前安装了 XAMPP)

spring - Spring Tomcat 应用程序中的 NoSuchMethodError

apache - "Invalid URI in request"尝试代理 iframe 内容进行本地调试

django - 为什么 Django 文档建议为静态文件使用单独的服务器?

ubuntu - 如何在 Ubuntu 15.10 中安装最新的 JMeter?

java - log4j :WARN No appenders could be found for logger (org. springframework.web.filter.CharacterEncodingFilter)。使用 log4j2

Tomcat 8 找不到 com.sun.faces.config.ConfigureListener 类