Hi all,
I’m running webapp on localhost and I’m trying to point example.local to localhost.
At first it seems easy, previously I was using Ubuntu, but I cannot get it to work properly on Manjaro.
My hosts file looks like this:
If I try to run it in Firefox it tells me that “We can’t connect to the server at example.local”
Also, when I change it like this, It points to localhost normally, but my server is configured to work on example.local
It is not really forbidden. But it depends on what services do you use for DNS. And how your nsswitch.conf is configured. It is still not a good idea to use a .local domain in such a way.
For example, on a system without avahi and systemd-resolved it works as expected.
Do you use systemd-resolved?
I’m not sure how the nsswitch.conf looks on Manjaro at the moment. But recently, the files option has been put at the back on Arch. This is one of the reasons you might have this problem at the moment. If you put the files option ahead of resolve and mdns_minimal, maybe even at the beiging of the hosts line, it should start to work.
TL;DR: Go to /etc/nsswitch.conf comment line hosts: (...) and replace it with hosts: files mdns4_minimal [NOTFOUND=return] dns
So if anyone had same issue on Manjaro, check your /etc/nsswitch.conf there is slight difference in Ubuntu and Manjaro:
Ubuntu
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.
passwd: files systemd
group: files systemd
shadow: files
gshadow: files
hosts: files mdns4_minimal [NOTFOUND=return] dns
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis
Manjaro
# Name Service Switch configuration file.
# See nsswitch.conf(5) for details.
passwd: files systemd
group: files [SUCCESS=merge] systemd
shadow: files systemd
gshadow: files systemd
publickey: files
hosts: mymachines mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] files myhostname dns
networks: files
protocols: files
services: files
ethers: files
rpc: files
netgroup: files
In order to make .local domain to work change hosts: section in Manjaro to that in Ubuntu
It is better to just move the files options after mymachines and not replace it the complet line. The Ubuntu nsswitch is not set up for modern software.
hosts: mymachines files mdns4_minimal [NOTFOUND=return] resolve [!UNAVAIL=return] myhostname dns