> For the complete documentation index, see [llms.txt](https://gdany-scripts.gitbook.io/debian-10/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gdany-scripts.gitbook.io/debian-10/apache2.md).

# Apache2

```shell
sudo apt update
sudo apt install apache2
sudo ufw app list
sudo ufw allow 'WWW'
sudo ufw status
sudo systemctl status apache2
hostname -I
```

Správa procesů

```shell
sudo systemctl stop apache2
sudo systemctl start apache2
sudo systemctl restart apache2
sudo systemctl reload apache2
sudo systemctl disable apache2
sudo systemctl enable apache2
```

Vytvoření webového adresáře

```shell
sudo mkdir -p /var/www/html
sudo chown -R $USER:$USER /var/www/html
sudo chmod -R 755 /var/www/html
nano /var/www/html/index.html
sudo nano /etc/apache2/sites-available/html.conf
```

```shell
<VirtualHost *:80>
    ServerAdmin admin@gdanyx.eu
    ServerName gdany.eu
    ServerAlias www.gdanyx.eu
    DocumentRoot /var/www/html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
```

```shell
sudo a2ensite html.conf
sudo a2dissite 000-default.conf
sudo apache2ctl configtest
```

{% code title="Výstup po zadání príkazů" %}

```shell
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 this message
Syntax OK
```

{% endcode %}

```shell
sudo systemctl restart apache2
```
