skip to Main Content

I am running an apache web server on my Raspberry Pi that hosts a website. To get the IP address of the server i used ifconfig and looked for the inet address under wlan0. I typed this address into chromium and reached /var/www/html/index.html. I do not want to reach this file, instead i was hoping to configure the server so that the first site i reach is /var/www/test/index.php.

How can i achieve this?

2

Answers


  1. First, you need to change the document root of apache to point to the /var/www/test directory.

    For this I advise you to follow this explanation : https://askubuntu.com/a/738527

    And then normally you will be able to access your page from other computers using the IP address of your PI.

    Login or Signup to reply.
  2. If you only have one webpage running on the Pi, you need to change the document root of the apache.

    A better solution is, to use virtual hosts with apache. Depending on the OS on the Pi there may be different paths for the Apache config files. I only know it for Debian (Raspbian).

    Then you have to enable the virtual host (a2ensite <configfile.conf>) and reload or restart Apache.

    If you are running a local Nameserver (like PiHole), you have to add the correct DNS entry for this virtual host. Or if you don’t have a local DNS you have to edit the /etc/hosts files on all machines you want to have access to this website. (There is also a hosts file on windows (i think it is in WindowsSystem32driversetc)

    Thats it 🙂

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search