AriyankiNet        
 


OSWorkingRaspbianArticle ≫ Apache2, PHP, and MySQL Installation on Raspbian

Apache2, PHP, and MySQL Installation on Raspbian

Wed 11 Nov 2015, 14:40


 

I follow this tutorial to install Apache2 and PHP in my Raspbian

https://www.raspberrypi.org/documentation/remote-access/web-server/apache.md

 

Then, I add MySQL Server installation command and some supporting module for PHP in one line, so that I can execute the installation process all at once:

 

sudo apt-get install apache2 php5 libapache2-mod-php5 mysql-server php5-mysql php5-gd -y

 

After installation process done, the default Document Root is in /var/www/html, but I do modification to the apache web server for my own needs. The config files is in /etc/apache2/ directory, I use nano for editor.

 

To add new port, modify port.conf file:

sudo nano ports.conf

add this if you want to use new port:

listen <newport>

 

To set Document Root modify sites-available/000-default.conf file:

sudo nano sites-available/000-default.conf

This is the example:

<VirtualHost *:81>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

 

To add security model modify apache2.conf file:

sudo nano apache2.conf

This is the example for security model:

<Directory /home/pi/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

 

To modify PHP Configuration, I use this command:

sudo nano /etc/php5/apache2/php.ini

 

After all configuration done, restart the apache:

sudo /etc/init.d/apache2 restart

 

If you need phpMyAdmin, you can download it from https://www.phpmyadmin.net/downloads/, extract the compressed file and put that in your Document Root.

 

 


0 428 views