Hello,
I am running NextCloudPi on Raspbian Linux. I want to add some host names to my /etc/hosts file so I can run different websites off the same local ip address (192.168.1.124) of the machine (Raspberry Pi) that nextcloudpi is installed and running on.
This is my /etc/hosts file:
127.0.0.1 localhost nextcloudpi website2
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters127.0.1.1 nextcloudpi website2
192.168.1.124 website2 website3
Here is my Apache2 virtualhost file:
<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>
When I am testing I type the url in a chrome browser on my laptop (192.168.1.101) that is on the same lan as the raspberry pi (192.168.1.124).
http://nextcloudpi DOES resolve to the local ip of the machine nextcloudpi is installed and running on. So I get the web page in chrome browser.
However when I add new host names to /etc/hosts they are not resolved to the local ip when I use them so the same web page does not appear in a url in chrome web browser. Instead if I try: http://website3 then Chrome gives the error message: " website3 ’s server IP address could not be found"
My question then is… 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.
Thank you,
Flex