如何将configure apache2转换为处理https

时间:2015-04-29 14:21:51

标签: apache ubuntu ssl https

我有一个已在http中运行的网站。我想为整个网站启用https。

我按照this site

上的教程进行操作

这是我的/etc/apache2/sites-available/default-ssl.conf文件

    IfModule mod_ssl.c>
    <VirtualHost _default_:443>
            ServerAdmin webmaster@localhost
            websitename websitename.com:443

            DocumentRoot /var/www/html

            # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
            # error, crit, alert, emerg.
            # It is also possible to configure the loglevel for particular
            # modules, e.g.
            #LogLevel info ssl:warn

现在,当我尝试重新启动apache时,我收到以下错误。

   * Starting web server apache2                                                                                                 * 
   * The apache2 configtest failed.
    Output of config test was:
    AH00526: Syntax error on line 4 of /etc/apache2/sites-enabled/default-ssl.conf:
    Invalid command 'websitename', perhaps misspelled or defined by a  module not included in the server configuration
    Action 'configtest' failed.
    The Apache error log may have more information.

1 个答案:

答案 0 :(得分:0)

websitename替换为ServerName

您可能还需要将端口443添加到ListenNameVirtualHost

请参阅here