Below are the commands to install Apache Web Server on Raspberry Pi board:
Check for latest updates before proceeding for any installation
pi@raspberrypi:~ $ sudo apt-get update
command to install Apache on raspberry pi
pi@raspberrypi:~ $ sudo apt install apache2 -y
Get the host address of Raspberry using below command
pi@raspberrypi:~ $ hostname -I
After you get the above address, type the address from another system and the default .html page opens.
If one wants to create an own html page , follow below procedure:
First install php:
sudo apt-get install php-fpm
Remove the default index.html and create a PHP script to be accessed from other system:
First point to the directory where default index.html is located
pi@raspberrypi:~ $ cd /var/www/html
Remove the existing file
pi@raspberrypi:/var/www/html $ sudo rm index.html
Create new php file
pi@raspberrypi:/var/www/html $ sudo nano index.php
Paste the below script which displays Welcome to Embeddeddesignblog when opened
<?php echo "Welcome to Embeddeddesignblog"; ?>
To save your file:
followed by y,
press Enter to exit.
0 Comments