阿帕奇没有启动

Arc*_*nda 10 server apache2 webserver

所以我尝试使用以下命令启动我的 apache2 服务器...

sudo service apache2 start
Run Code Online (Sandbox Code Playgroud)

但是后来我收到此错误消息...

Job for apache2.service failed. See "systemctl status apache2.service" and "journalctl -xe" for details.
Run Code Online (Sandbox Code Playgroud)

所以当我尝试查看 systemctl 时,我得到了这个......

? apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2)
   Active: failed (Result: exit-code) since Mon 2015-07-06 10:34:49 IST; 4min 23s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 8899 ExecStart=/etc/init.d/apache2 start (code=exited, status=2)

Jul 06 10:34:49 archisman-HP-ProBook-440-G2 systemd[1]: Starting LSB: Apache2 web server...
Jul 06 10:34:49 archisman-HP-ProBook-440-G2 apache2[8899]: /etc/init.d/apache2: 64: .: Can't open /etc/apache2/envvars
Jul 06 10:34:49 archisman-HP-ProBook-440-G2 apache2[8899]: /etc/init.d/apache2: 76: .: Can't open /etc/apache2/envvars
Jul 06 10:34:49 archisman-HP-ProBook-440-G2 apache2[8899]: ERROR: APACHE_PID_FILE needs to be defined in /etc/apache2/envvars
Jul 06 10:34:49 archisman-HP-ProBook-440-G2 systemd[1]: apache2.service: control process exited, code=exited status=2
Jul 06 10:34:49 archisman-HP-ProBook-440-G2 systemd[1]: Failed to start LSB: Apache2 web server.
Jul 06 10:34:49 archisman-HP-ProBook-440-G2 systemd[1]: Unit apache2.service entered failed state.
Jul 06 10:34:49 archisman-HP-ProBook-440-G2 systemd[1]: apache2.service failed.
Run Code Online (Sandbox Code Playgroud)

我浏览器上的http://localhost/也给了我一个错误,这意味着 apache 没有运行。

当我这样做时...

sudo restart apache2
Run Code Online (Sandbox Code Playgroud)

我收到这个错误...

restart: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused
Run Code Online (Sandbox Code Playgroud)

有人请帮忙。

bis*_*oco 5

我认为由于某种原因您删除了 envvars 配置文件

Jul 06 10:34:49 archisman-HP-ProBook-440-G2 apache2[8899]: /etc/init.d/apache2: 64: .: Can't open /etc/apache2/envvars
Jul 06 10:34:49 archisman-HP-ProBook-440-G2 apache2[8899]: /etc/init.d/apache2: 76: .: Can't open /etc/apache2/envvars
Run Code Online (Sandbox Code Playgroud)

所以你必须创建它并从这里粘贴内容(此文件的默认内容)

sudo touch /etc/apache2/envvars
sudo nano /etc/apache2/envvars
Run Code Online (Sandbox Code Playgroud)

然后照常重启apache服务

sudo service apache2 restart
Run Code Online (Sandbox Code Playgroud)