LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Internal website - Raspberry Pi (https://www.linuxquestions.org/questions/linux-newbie-8/internal-website-raspberry-pi-4175529220/)

fbooth 12-25-2014 10:47 AM

Internal website - Raspberry Pi
 
When I address (with the browser) the IP of the Raspberry Pi, where does it go to obtain the response... does it always go to /var/www?

I find during experimentation: one time it went to index.php and another time it went to index.html. How do I maintain the exact location?

veerain 12-25-2014 10:57 AM

If the httpd webserver is configured to serve webpages from /var/www then it would look in to that. Usually /etc/httpd.conf holds the option to look where and also default page to serve. i.e. either index.html or index.php. You can instead give it full filename like http://address/index.php

fbooth 12-25-2014 11:15 AM

Quote:

Originally Posted by veerain (Post 5290372)
If the httpd webserver is configured to serve webpages from /var/www then it would look in to that. Usually /etc/httpd.conf holds the option to look where and also default page to serve. i.e. either index.html or index.php. You can instead give it full filename like http://address/index.php

Thank you! That cleared up my understanding of how the webserver is configured.

schneidz 12-25-2014 11:16 AM

my limited experience with apache is that its chrooted directory tree is in /var/www/html and that the default page is index.html and if that doesn't exist it looks for index.php.

edit: jinx veerain.

sycamorex 12-25-2014 12:10 PM

The default root directory can be checked in httpd.conf

On my Slackware server it's:
Code:

...
<Directory "/srv/httpd/htdocs">
...

To enable .php pages, you need to uncomment the following line in httpd.conf:
Code:

Include /etc/httpd/mod_php.conf
Also, the code below specifies the order of reading files (first the server will check for .php files. If they are not present, .html files will be looked for.

Code:

<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>

You can have your root directory elsewhere - for example in your home directory. To do this you need to uncomment the line below (and edit the httpd-userdir.conf file accordingly):
Code:

# Include /etc/httpd/extra/httpd-userdir.conf
Bear in mind that the last option might not be enabled by default. For example, on Slackware in the stock apache package the 'userdir' option is not enabled.

jlinkels 12-25-2014 03:58 PM

and don't forget to restart Apache to reload the configration after you have made changes.

jlinkels

Miati 12-26-2014 12:46 AM

Code:

        <Directory /var/www/example>
        DirectoryIndex gallery.html index.html directory_index.html
        Options Indexes FollowSymLinks
        AllowOverride None

        Allow from all
        Satisfy all

        </Directory>

This is a pretty simple version of a website.
The "index" files are specified as DirectoryIndex, with the first having preference (if your local ip starts with 192.168.1.*
Various options
AllowOverride (involves .htaccess files, I don't use them so I disable them)

Allow from all, this means anyone can access at any time. You can make this more specialized eg. Allow from 192.168.1.1/24 to permit all lan but no external addresses
Satisfy all, make sure all requirements are satisfied before permitting access


All times are GMT -5. The time now is 01:49 PM.