Apache Webserver (met PHP, MySQL, PHPMyAdmin en OpenSSL)
Zie ook: http://www.wikihow.com/Make-a-Raspberry-Pi-Web-ServerInstalleren van Apache2 webserver met PHP:
sudo apt-get install apache2 php5 libapache2-mod-php5
sudo /etc/init.d/apache2 restart
De server map is hier te vinden: /var/www/
Installeren van MySQL database:
sudo apt-get install mysql-server mysql-client php5-mysql
Installeren van PHPMyAdmin:
sudo apt-get install phpmyadmin
Instellingen bij installeren:
Web server: apache2
dbconfig-common: Yes
sudo nano /etc/apache2/apache2.conf
Voeg de volgende regel toe aan het bestand:
Include /etc/phpmyadmin/apache.conf
Save the file (CTRL + X and enter Y when prompted to save) and restart Apache2. To restart Apache, enter the following command:
sudo /etc/init.d/apache2 restart
Eventueel de hele raspberry nog eens opstarten als phpmyadmin niet werkt!
OpenSSL/ https linken
OpenSSL is al geïnstalleerd in Raspbian Jessie. Dus het volgende commando is dan niet nodig, maar kan eventueel uitgevoerd worden voor een update:
sudo apt-get install openssl
De SSL certificaten aanmaken:
sudo mkdir -p /etc/ssl/localcerts
sudo openssl req -new -x509 -days 365 -nodes -out /etc/ssl/localcerts/apache.pem -keyout /etc/ssl/localcerts/apache.key
sudo chmod 600 /etc/ssl/localcerts/apache*
SSL inschakelen:
sudo a2enmod ssl
sudo nano /etc/apache2/sites-available/default-ssl.conf
Ik heb de virtual host regel aangepast naar:
<VirtualHost *:443>
SSL website activeren:
sudo a2ensite default-ssl.conf
LET OP: op meerdere websites wordt aangeraden om poort 443 aan te maken in ports.conf. Maar als je dat doet in Debian Jessie, dan start de apache webserver niet meer op! Je hoeft dus niets te wijzigen in ports.conf.
Webserver opnieuw starten:
sudo service apache2 restart
NGinx webserver (met PHP, MySQL en PHPMyAdmin)
Het is beter om NGinx te installeren dan Apache, Apache is een vrij zware server voor de RPI.Zelf gebruik ben ik weer overgestapt op Apache, omdat ik daar beter mee overweg kan...
http://xmodulo.com/lightweight-web-server-raspberry-pi.html
$ sudo apt-get update
$ sudo apt-get install nginx
$ sudo mkdir /var/www
Instellingen aanpassen in het default bestand zodat het er ongeveer zo uit komt te zien:
$ sudo nano /etc/nginx/sites-available/default
server {
listen 80;
server_name $domain_name;
root /var/www;
index index.html index.htm index.php; HIER index.php AAN TOEVOEGEN.
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
}
$ sudo service nginx restart
PHP toevoegen:
$ sudo apt-get install php5-fpm php-apc
$ sudo nano /etc/nginx/sites-available/default
server {
listen 80;
server_name $domain_name;
root /var/www;
index index.html index.htm;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
MySQL en PHPMyAdmin toevoegen
$ sudo service nginx restart
MySQL en PHPMyAdmin toevoegen
$ sudo apt-get install mysql-server mysql-client php5-mysql phpmyadmin
During MySQL server installation process, you will be asked to configure the password for root user of MySQL. You will also be asked to choose the web server installed in the system (Apache2 or Lighttpd). In case of Nginx, you can leave the web server selection field empty.
During phpMyAdmin installation, you will be asked to configure database for phpMyAdmin. Answer "yes". When asked to enter the password of the administrative user, provide the password.
Open phpMyAdmin from your browser by going to http://<raspberrypi-ip-address>/phpmyadmin, and log in as "root" using the administrative password that you have set earlier.
$ sudo ln -s /usr/share/phpmyadmin /var/www/phpmyadmin
Open phpMyAdmin from your browser by going to http://<raspberrypi-ip-address>/phpmyadmin, and log in as "root" using the administrative password that you have set earlier.
Bij mij bleef Apache lastig, na een reboot was Apache toch weer gestart. Met het volgende commando wordt Apache uit het opstart bestand gehaald:
sudo update-rc.d apache2 disable
sudo update-rc.d apache2 disable