In my local LAN I have my laptop (192.168.1.101) and a Raspberry Pi (192.168.1.124). I have apache2 web server on the Pi running NextCloudPi file server.
Typing http://nextcloudpi into Chrome on my laptop pulls up a little web page I have on that apache2.
This is my /etc/hosts file:
Code: Select all
127.0.0.1 localhost.localdomain localhost
127.0.1.1 nextcloudpi
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
192.168.1.124 nextcloudpi website2 website3
Code: Select all
<VirtualHost _default_:80>
ServerName nextcloudpi:80
ServerAlias website2 website3
DocumentRoot /var/www/mymovies
ServerAdmin webmaster@localhost
DocumentRoot /var/www/mymovies
ErrorLog /var/www/mymovies/logs/http-error.log
CustomLog /var/www/mymovies/logs/http-access.log combined
<Directory /var/www/mymovies/>
#Require host localhost
#Require ip 127.0.0.1
#Require ip 192.168
#Require ip 10
</Directory>
</VirtualHost>
Host names - website2 and website3 - should make the same web page appear but they don't. Instead if I try: http://website2 (or website3) then Chrome gives the error message: " website3 ’s server IP address could not be found" "ERR_NAME_NOT_RESOLVED"
How come http://nextcloudpi resolves to the correct local ip address but when I add other host names into /etc/hosts they are not recognized? I’m thinking the format of my /etc/hosts file is wrong but after much googling I don’t see what is wrong with it. nextcloudpi is in /etc/hostnames maybe that is why?
Code: Select all
nano /etc/nsswitch.conf
Code: Select all
hosts: files mdns4_minimal [NOTFOUND=return] dns
I have also tried flushing the dns cache on the laptop and on the Pi and restarting the Pi... many times.
Thank you,
Flex