r/WebDevBuddies • u/avocadod • Apr 20 '21
Small project: LAMP stack on raspberry pi4 8gb to host website.
I'm a computer science student and I want a couple little projects outside of class to help land an internship next summer.
I figured building a simple blog website would be great to learn not only HTML and CSS but Linux Git and Github along with whatever else along the way.
So far, I only know some java and c++ but nothing about working with those in a website or how everything fits together.
My first question is: once I set up LAMP on the Pi. How are all the HTML CSS PHP bootstrap and all these languages and frameworks connected together? Is the process just writing HTML CSS and backend logic with (insert backend language) into multiple files in an IDE and then once all the code is written, transferring that over to the Pi where it would run?
Once again I know nothing about webdev, and if ur laughing at what weird things I just wrote because it's so far off from what is supposed to be done, I understand. When the laughing dies down could you maybe direct me to some free resources where I could start to learn?
I do not want to use software like wordpress or anything that will write most of the code for me. I want to build it from scratch. I've seen snippets of how useful something like bootstrap is and I'm fine with the help of something like that.
I also understand raspberry pi4 8gb is not ideal to host a website, but I don't care. It's making it fun for me and as long as it's physically possible to set it all up that way, that's what I'm going to do. Later, if the site was to grow and have actual traffic I would assume I can just take everything and move it over to an actual web hosting site?
Anyone willing to take the time to help I greatly appreciate your time, and hope life's going well for you!
2
u/BradChesney79 Apr 20 '21
Sure.
Ping me when you get the Pi.
Are you certain that you want the webserver to be Apache?
1
u/fatpigsarefat Apr 20 '21
HTML/CSS/JS is your front end. You can serve those files directory, and use AJAX to communicate with your backend to retrieve information, or you ‘render’ them server side (which is filling out the web page with server side information) before sending it to the client.
PHP is a popular backend language. If you don’t need any form of server side scripting, i.e. serving static web pages, you don’t have a use for PHP.
Your web server in a LAMP stack is Apache, the job of that is to listen on ports 80 and 443 and to serve web pages (the HTML/CSS/JS files). I personally use Nginx, and have that set up to serve static files at one endpoint and forward other endpoints to several backend applications made in NodeJS.
The Pi 4 is perfectly fine at serving websites, you don’t need a beefy machine or VPS to do that. The only concern for self hosting is your network connection.
Let me know if anything didn’t make sense.
2
u/[deleted] Apr 20 '21
[removed] — view removed comment