Banana Pi Web Server



Install Web Server



sudo apt-get install tasksel

sudo tasksel

check LAMP

ok

enter MySQL password


test:

open web browser

go to localhost

should say "it works"



also, install phpmyadmin

apt-get install phpmyadmin

the user name of the administrative user will be root


Change web root folder

By default, the web root will be at /var/www

This means that when you place a file name index.html in your web root and point a web browser to the address of your web server (on your Banana Pi, it is localhost. On a remote machine, it will be the IP address of you Banana Pi.)

The downside for development is that this folder is owned by root, and you don't want to open up this folder to any user other root.
One solution is to change the location of the root folder to somewhere else.
Here, we will assume that you have a folder on an external device named /media/data/public_html

Edit the file

 sudo nano /etc/apache2/sites-­available/000-­default.conf

Change the line

        DocumentRoot /var/www/html

to
        DocumentRoot /media/data/public_html


Save the file.

Restart the Apache server:

sudo service apache2 restart


Now, you will probably get a "Forbidden" message in the web browser.

To fix that, add between the VirtualHost tags:

<VirtualHost *:80>
..
<Directory /media/data/public_html> 
   Order allow,deny 
   Allow from all 
   # New directive needed in Apache 2.4.3: 
   Require all granted 
</Directory>
..
</VirtualHost> 







No comments:

Post a Comment