I have a litle problem with my virtual host configuration on Apache2.
Context : I have a Raspberry Pi with Apache2 installed. I want to access to my test directory in : "/var/www/html/test".
So I modified my 000-default.conf in "/etc/apache2/sites-available" like this and this worked:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
NameVirtualHost 192.168.1.29:80
<VirtualHost 192.168.1.29:80>
ServerName raspyvan
DocumentRoot /var/www/html/test
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
(raspyvan is my servername on my router ans host file)
But I would deny the access with IP adress "192.168.1.29"
So I modified in a second time my 000-default.conf file like this :
Listen 192.168.1.29:80
ServerName DefaultServer
DocumentRoot /var/www/html
NameVirtualHost 192.168.1.29:80
<VirtualHost 192.168.1.29:80>
ServerName 192.168.1.29
<Directory />
Deny from all
</Directory>
</VirtualHost>
<VirtualHost 192.168.1.29:80>
ServerName raspyvan
DocumentRoot /var/www/test
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Now the problem is that the access by IP and hostname are denied and I don't know why.
Edit : My nameserver is apply on the DNS router config and hosts apache file.