I have a problem whenever I try to set-up a virtual host using apache on Debian 10.
I am trying to set-up virtual host on the address products.crud. So the directory structure is var/www/products.crub/web.
So, I created the Apache Virtual Hosts configuration file in in /etc/apache2/sites-available directory and can I also enabled it in /etc/apache2/sites-enabled directory. The content of the file named products.crud.conf is:
<VirtualHost *:80>
ServerName products.crud
DocumentRoot /var/www/products.crud/web
<Directory /var/www/products.crud/web>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
</Directory>
So, I enabled the domain using:
$ sudo a2ensite products.crud
And then I tested the syntax using
$ sudo apachectl configtest
The problem is that I receive this error:
AH00558: apache2: Could not reliably determine the server’s fully qualified domain name, using fe80::2ff5:a177:ff45:30b3. Set the ‘ServerName’ directive globally to suppress this message
Syntax OK
What I tried to solve the issue
I tried adding the domain in /etc/hosts
127.0.0.1 localhost
#127.0.1.1 terminale
#127.0.0.1 products.test
127.0.0.5 products.crud
I also tried to add in apache2.conf:
# Global configuration
#
ServerName products.crud
#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
Whenever I try to connect to products.crud I see the localhost main page of apache and not my index.php. How can I solve this?
2
Answers
What if you change the ServerName
products.test
to ServerNameproducts.crud
in yourproducts.crud.conf
file, like this:If you go to:
/etc/apache2/apache2.conf
and insert:
ServerName localhost
and then restart apache by typing into the terminal:
sudo systemctl reload apache2
reference
https://codeinfopark.com/questions/ah00558-apache2-could-not-reliably-determine-the-servers-fully-qualified-domain-name-using-172-18-0-3-set-the-servername-directive-globally-to-suppress-this-message/