2017-08-01 104 views
-1

我的服務器是Ubuntu,我正在運行Apache2。我使用Apache來指向我的網絡應用程序加載在tomcat。以下是我的000-default.conf文件。無法在Apache中安裝SSL

<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 EngineSSLEngine,執行sudo a2enmod ssl等,但同樣的錯誤用武之地。

我怎樣才能解決這個問題呢?

回答

2

錯誤消息明確指出了問題:

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和發動機之間的空間解決它:

SSLEngine On 
+0

是的,我之前解決了它,如我的問題所述,但沒有按預期工作。無論如何,它突然開始工作 –