全新安装的 Debian,无法让 Apache 运行

全新安装的 Debian,无法让 Apache 运行

我不得不重新安装 Debian。重新安装之前,我一直将我的服务器用作文件共享(使用 Owncloud)。在新格式化的驱动器上重新安装 Debian 并安装 apache2 后,我无法显示默认页面。

Apache 服务正在运行:

    ● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2)
   Active: active (running) since Mon 2016-08-08 14:39:45 UTC; 10min ago
  Process: 2571 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
  Process: 2597 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/apache2.service
           ├─2613 /usr/sbin/apache2 -k start
           ├─2617 /usr/sbin/apache2 -k start
           ├─2618 /usr/sbin/apache2 -k start
           ├─2619 /usr/sbin/apache2 -k start
           ├─2620 /usr/sbin/apache2 -k start
           └─2621 /usr/sbin/apache2 -k start

Aug 08 14:39:44 raspberrypi apache2[2597]: Starting web server: apache2AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally ...ress this message
Aug 08 14:39:45 raspberrypi apache2[2597]: .
Aug 08 14:39:45 raspberrypi systemd[1]: Started LSB: Apache2 web server.
Hint: Some lines were ellipsized, use -l to show in full.

如果我运行,apache2 -t我会得到以下结果:

    [Mon Aug 08 14:52:00.502453 2016] [core:warn] [pid 2753] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Mon Aug 08 14:52:00.502855 2016] [core:warn] [pid 2753] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Mon Aug 08 14:52:00.502892 2016] [core:warn] [pid 2753] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Mon Aug 08 14:52:00.502966 2016] [core:warn] [pid 2753] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Mon Aug 08 14:52:00.595580 2016] [core:warn] [pid 2753] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Mon Aug 08 14:52:00.596803 2016] [core:warn] [pid 2753] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Mon Aug 08 14:52:00.596883 2016] [core:warn] [pid 2753] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
AH00543: apache2: bad user name ${APACHE_RUN_USER}

如果我运行netstat -tap我会得到这个:

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 localhost:mysql         *:*                     LISTEN      1017/mysqld
tcp        0      0 *:webmin                *:*                     LISTEN      1413/perl
tcp        0      0 *:ssh                   *:*                     LISTEN      538/sshd
tcp        0     64 raspberrypi.home:ssh    static-xxx-xx-xx-:59984 ESTABLISHED 2011/sshd: pi [priv
tcp6       0      0 [::]:http               [::]:*                  LISTEN      2613/apache2
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN      538/sshd

我的 apache 用户和组设置为www-data:www-data

更新:

所有 http 上的流量都在运行,但它甚至没有尝试通过 https 进行连接,日志中没有显示任何内容,并且 iptables 和我的路由器上的端口 443 都处于打开状态

答案1

好吧,我终于明白了:

问题是 apache2 中未启用 ssl 模块。要启用它,我必须:

输入a2enmod ssl并按回车键 然后service apache2 restart输入按回车键

并且成功了

相关内容