I'm new with Ubuntu and Terminal, I have Ubuntu 18.04. First time I installed LAMP server using tasksel...and everything was working fine, and then, after some time, I can't start anything. I tried to use some commands but all i see is: can't restart because of error.
I remove all thinking it might help, and then it's all good. But i don't want to delete and install every time that server. Can somebody tell me what might be the problem and how to fix it?
If I use sudo apache2ctl restart
this happens:
(2)No such file or directory: AH02291: Cannot access directory
'/var/log/apache2/' for main error log
(2)No such file or directory: AH02291: Cannot access directory
'/var/log/apache2/' for error log of vhost defined at
/etc/apache2/sites-enabled/000-default.conf:1
AH00014: Configuration check failed
Action 'restart' failed.
The Apache error log may have more information.
EDIT: now everything's working except mysql service.
I tried systemctl status mysql.service
and this happened:
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor
preset: enabled)
Active: failed (Result: exit-code) since Tue 2018-07-10 19:53:53 CEST;
6s ago
Process: 6021 ExecStart=/usr/sbin/mysqld --daemonize --pid-
file=/run/mysqld/mysqld.pid (code=exited
Process: 6012 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre
(code=exited, status=0/SUCCESS)
Why I can't restart it or anything?? Please help
The error message you got is pretty self-explanatory:
Make sure the directory
/var/log/apache2/
exists, and if it does not, create it and launch Apache again.While this directory should be made on installation, sometimes the package manager does a stupid and doesn't create it. So you can recreate it fairly easily with
sudo mkdir /var/log/apache2/
and it should then work.