'sudo service apache2 start'在ubuntu18.04上不起作用

时间:2018-10-29 08:55:51

标签: ubuntu laravel-5

我已经在ubuntu18.04上安装了laravel。 然后我制作了/etc/apache2/sites-available/laravel.conf文件。

<VirtualHost *:80>
    ServerName yourdomain.tld

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/your-project/public

    <Directory /var/www/html/your-project>
        AllowOverride All
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

然后在终端上运行以下代码:

sudo a2dissite 000-default.conf
sudo a2ensite laravel.conf
sudo a2enmod rewrite
sudo service apache2 restart
但是,当我运行“ sudo service apache2 restart”时,会出现错误代码。

Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.

我同时运行了“ systemctl status apache2.service”和“ journalctl -xe”,但是也有错误代码:

apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: failed (Result: exit-code) since Mon 2018-10-29 01:48:17 PDT; 5min ago
  Process: 40882 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

Oct 29 01:48:17 ubuntu apachectl[40882]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress thi
Oct 29 01:48:17 ubuntu apachectl[40882]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
Oct 29 01:48:17 ubuntu apachectl[40882]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
Oct 29 01:48:17 ubuntu apachectl[40882]: no listening sockets available, shutting down
Oct 29 01:48:17 ubuntu apachectl[40882]: AH00015: Unable to open logs
Oct 29 01:48:17 ubuntu apachectl[40882]: Action 'start' failed.
Oct 29 01:48:17 ubuntu apachectl[40882]: The Apache error log may have more information.
Oct 29 01:48:17 ubuntu systemd[1]: apache2.service: Control process exited, code=exited status=1
Oct 29 01:48:17 ubuntu systemd[1]: apache2.service: Failed with result 'exit-code'.
Oct 29 01:48:17 ubuntu systemd[1]: Failed to start The Apache HTTP Server.

如何启动Apache Http服务器。 有人帮我!

1 个答案:

答案 0 :(得分:1)

按照此链接逐步操作,您将获得解决方案。 仅当我们正确配置防火墙或未正确配置防火墙时,它才会发生。 看到这个https://www.digitalocean.com/community/tutorials/how-to-install-the-apache-web-server-on-ubuntu-16-04