-
Notifications
You must be signed in to change notification settings - Fork 1
J. Web Server
Can serve HTML files over HTTP and also over HTTPS protocols. With additional modules such as PHP it can also server dynamic content. Apache is one of the most popular web servers available for Raspberry PI, alternatively we can use Nginx web server, but for this exercise we will stick to LAMP framework.
Funny enough, you've been already using it and we already installed 75% of it.
L - Linux
A - Apache
M - MySQL/MariaDB
P - Python/PHP/Perl
Citing Wikipedia:
"LAMP (Linux, Apache, MySQL, PHP/Perl/Python) is a very common example of a web service stack, named as an acronym of the names of its original four open-source components: the Linux operating system, the Apache HTTP Server, the MySQL relational database management system (RDBMS), and the PHP programming language. The LAMP components are largely interchangeable and not limited to the original selection. As a solution stack, LAMP is suitable for building dynamic web sites and web applications."
Luckily, we already did this here. So we can skip this step.
-
Open a terminal and type:
$ hostname -i
-
Now take that ip (192.168.x.x) , in my case 192.168.1.31 and paste it in any browser.
-
What do you see?
-
I think we're both going to be greeted with the same page and message: It works!
Sure it does, we're smart like that ๐๐ฅ.
I'm going to be using the sambullet pointsts from above we this is more of a continuation, not a separate chapter.
-
We must set up permissions to be able to make changes within the /var/www/html without using root.
a. First, we must add our user: ubuntu to the www-data group. Ubuntu should be default, but if you you don't know your user or you changed it in the meantime just type in the terminal
$ whoami
.b. Second, we must give ownership to all the files from the folders in /var/www/html directory to the www-data group.
ubuntu: ubuntu/ :sudo usermod -a -G www-data ubuntu
ubuntu: ubuntu/ :sudo chown -R -f www-data:www-data /var/www/html
-
Close your terminal and reopen for the changes to take effect.
-
You can now make changes to the default web page by using
nano
orvim
.vim /var/www/html/index.html
Result ๐:
**Congrats, you're done!**
We have learned about the LAMP stack and finished implementing it.
We have also learned how to give permissions to modify the index.html in order to create our own webpage.
If you hit a problem or have feedback (which is highly welcomed) please feel free to get in touch, more details in the footer.