apache - 如何转换configure apache2来处理https

标签 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.

最佳答案

websitename 替换为 ServerName

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

参见 here

关于apache - 如何转换configure apache2来处理https,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29946524/

相关文章:

php - Apache 耗尽所有内存,网站上没有访客

c++ - 使用 PyTorch、HElib 和 OpenCV 编译 C++ 程序时出现问题

php - 重写 url 以删除问号并在 htaccess 中添加斜线

php - 没有指定输入文件 plesk server4you

ruby-on-rails - 找不到 Gemfile 或 .bundle/目录 ----- rvm |计划 | Ubuntu |每当

perl - Perl库Net版本> 0.66的安装

android - 来自带有 Playscape SDK 的 GameMaker 应用的 Google Play SSL 安全警报

docker - 使用 SSL 的 Nginx 子域重定向不起作用

c++ - 如何更改 boost::asio::ssl::context 的方法

linux - 让 Apache httpd 监听端口 80,但不是以 root 身份启动?