> For the complete documentation index, see [llms.txt](https://olexsyn.gitbook.io/enote/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://olexsyn.gitbook.io/enote/linux/apache.md).

# Apache

#### Версія

```
/usr/sbin/apache2 -v

Server version: Apache/2.4.29 (Ubuntu)
Server built:   2020-03-13T12:26:16"
```

#### Стан

```
systemctl status apache2
```

#### Перевірка конфігурації

```
apache2ctl configtest
```

Допомагає знайти помилку у файлах конфігурації

#### Стоп, старт, рестарт

```
systemctl stop|start|restart|reload|status apache2
```

а також, в інших дистрибутивах Linux:

```
systemctl status httpd
systemctl stop|start|restart httpd.service
```

```
/etc/init.d/apache2 status
/etc/init.d/apache2 stop|start|restart|reload|force-reload
```

### restart и reload - різниця?

* restart: зупиняє (stop), а потім запускає (start) службу Apache.
* reload: витончено перезапускає службу Apache. При reload основний процес Apache завершує роботу дочірніх процесів, завантажує нову конфігурацію та запускає нові дочірні процеси.

> <mark style="color:$warning;background-color:$danger;">! Якщо з'являється повідомлення</mark>\
> `AH00558: httpd: Could not reliably determine the server's fully qualified`\
> необхідно прописати `ServerName localhost`\
> у файлі **/etc/apache2/apache2.conf** (или **/etc/httpd/conf/httpd.conf**)
