I have installed two things :

A wi-fi access point through this tutorial : https://learn.adafruit.com/setting-up-a-raspberry-pi-as-a-wifi-access-point

And a Apache server from this tutorial : https://www.raspberrypi.org/documentation/remote-access/web-server/apache.md

Now, from my phone for example, I can freely connect to my wi-fi access point and then access the apache server using the address

But I do not know how to assign a hostname, so that I can access my apache server using a link like "h t t p : / / my-raspberry-pi" instead of "h t t p : / /"

If my English can seem awful, know that I am French and that I use Google translator to try to express myself as clearly as possible

  • on the machines you want to connect from add an entry to the hosts file (google for how to do this based on your OS and version. The Pi already has a hostname which you can check with the hostname command and you can change this if needed via raspi-config. You may also want to add a hosname entry to the hosts file on your Pi as well. – Steve Robillard Feb 26 '17 at 14:28

As Steve Robilliard has stated the Pi already has a hostname, raspberrypi by default.

You should be able to address it with raspberrypi.local, although this relies on the avahi service (which is running on normal Raspbian). The use of it is discusssed in How do I set up networking/WiFi/Static IP.

If you want to change the hostname, it is STRONGLY recommended that you do this with raspi-config, which correctly changes ALL the files needed.

If you do it manually BOTH /etc/hosts and /etc/hostname need to be consistent (or you will get inexplicable error messages from some commands).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.