# 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
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gdany-scripts.gitbook.io/debian-10/apache2.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
