Linux - nejde Apache - AH02291 Cannot access directory
Dobrý den,
přestal mně z ničeho nic po restartu fungovat webserver Apache 2 na linuxu. Píše to ve statusu toto:
Máš tam chybu, že není přístupný adresář /var/log/apache2/ , zkus ho vytvořit a nahodit apache znovu.
Díky tak to najelo, všechny weby s PHP jedou, ale nefunguje nextcloud, je tam bílá stránka. Jak povolím výpis chyb z PHP?
Zobrazení chyb z PHP uděláš takto:
error_reporting = E_ALL | E_STRICT
display_errors = On
display_startup_errors = On
Tak nefungovala i databáze MySQL:
přestal mně z ničeho nic po restartu fungovat webserver Apache 2 na linuxu. Píše to ve statusu toto:
root@xxx:~#/etc/init.d/apache2 status
● apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2)
Drop-In: /lib/systemd/system/apache2.service.d
└─forking.conf
Active: failed (Result: exit-code) since Thu 2016-12-29 13:17:06 UTC; 1h 2min ago
Process: 591 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILUR E)
Dec 29 13:17:06 xxxx apache2[591]: AH00557: apache2: apr_sockaddr_in...2
Dec 29 13:17:06 xxxx apache2[591]: AH00558: apache2: Could not relia...e
Dec 29 13:17:06 xxxx apache2[591]: (2)No such file or directory: AH0...g
Dec 29 13:17:06 xxxx apache2[591]: (2)No such file or directory: AH0...1
Dec 29 13:17:06 xxxx apache2[591]: AH00014: Configuration check failed
Dec 29 13:17:06 xxxx apache2[591]: Action 'configtest' failed.
Dec 29 13:17:06 xxxx apache2[591]: The Apache error log may have mor....
Dec 29 13:17:06 xxxx systemd[1]: apache2.service: control process ex...1
Dec 29 13:17:06 xxxx systemd[1]: Failed to start LSB: Apache2 web se....
Dec 29 13:17:06 xxxx systemd[1]: Unit apache2.service entered failed....
Warning: Unit file changed on disk, 'systemctl daemon-reload' recommended.
Hint: Some lines were ellipsized, use -l to show in full.
root@xxx:~#apachectl configtest
[Thu Dec 29 14:28:36.777685 2016] [core:error] [pid 2186] (EAI 2)Name or service not known: AH00547: Could not resolve host name *.8 0 -- ignoring!
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' direc tive globally to suppress this message
(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/si tes-enabled/000-default.conf:1
AH00014: Configuration check failed
Action 'configtest' failed.
The Apache error log may have more information.
ODPOVĚĎ
Máš tam chybu, že není přístupný adresář /var/log/apache2/ , zkus ho vytvořit a nahodit apache znovu.
ODPOVĚĎ
Díky tak to najelo, všechny weby s PHP jedou, ale nefunguje nextcloud, je tam bílá stránka. Jak povolím výpis chyb z PHP?
ODPOVĚĎ
Zobrazení chyb z PHP uděláš takto:
php --ini
nano /etc/php5/apache2/php.ini
error_reporting = E_ALL | E_STRICT
display_errors = On
display_startup_errors = On
service apache2 restart
ODPOVĚĎ
Tak nefungovala i databáze MySQL:
● mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql)
Active: failed (Result: exit-code) since Thu 2016-12-29 19:40:24 UTC; 2min 57s ago
Process: 3968 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)
Dec 29 19:40:24 xxxx /etc/init.d/mysql[4728]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
Dec 29 19:40:24 xxxx /etc/init.d/mysql[4728]: [61B blob data]
Dec 29 19:40:24 xxxx /etc/init.d/mysql[4728]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Dec 29 19:40:24 xxxx mysql[3968]: Starting MySQL database server: mysqld . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . failed!
Dec 29 19:40:24 xxxx systemd[1]: mysql.service: control process exited, code=exited status=1
Dec 29 19:40:24 xxxx systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
Dec 29 19:40:24 xxxx systemd[1]: Unit mysql.service entered failed state.
● mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql)
Active: failed (Result: exit-code) since Thu 2016-12-29 19:40:24 UTC; 3min 43s ago
Process: 3968 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)
Dec 29 19:40:24 xxxx /etc/init.d/mysql[4728]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
Dec 29 19:40:24 xxxx /etc/init.d/mysql[4728]: [61B blob data]
Dec 29 19:40:24 xxxx /etc/init.d/mysql[4728]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Dec 29 19:40:24 xxxx mysql[3968]: Starting MySQL database server: mysqld . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . failed!
Dec 29 19:40:24 xxxx systemd[1]: mysql.service: control process exited, code=exited status=1
Dec 29 19:40:24 xxxx systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
Dec 29 19:40:24 xxxx systemd[1]: Unit mysql.service entered failed state.
ŘEŠENÍ:
To bylo způsobeno neexistencí adresáře /var/log/mysql , pak se mysql server rozjel a už znám příčinu. Chtěl jsem šetřit SSD disk od neustálých zápisů do logů a nastavil jsem ukládání logů do ramky přes tmpfsnano /etc/fstab
tmpfs /var/log tmpfs defaults,noatime,nosuid,mode=0755,size=100m 0 0