Basic Apache2 vhost configuration doesn't work
2
votes
1
answer
1887
views
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:
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
NameVirtualHost 192.168.1.29:80
ServerName raspyvan
DocumentRoot /var/www/html/test
# 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
ServerName 192.168.1.29
Deny from all
ServerName raspyvan
DocumentRoot /var/www/test
# 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.
Asked by Yvan
(21 rep)
Nov 23, 2016, 08:19 PM
Last activity: Jul 14, 2025, 08:04 AM
Last activity: Jul 14, 2025, 08:04 AM