itkenb
Posts: 5
Joined: Sat Feb 15, 2020 10:07 am

Question: Pi 4 as a web server

Sat Feb 15, 2020 10:54 am

Thinking to buy a pi 4 and use it as a web server

I want to run
PHP7 and Mysql
simple system for hotel room management that would update both local and online database


any tips or suggestions?
TIA

fruitoftheloom
Posts: 22062
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Question: Pi 4 as a web server

Sat Feb 15, 2020 11:32 am

itkenb wrote:
Sat Feb 15, 2020 10:54 am
Thinking to buy a pi 4 and use it as a web server

I want to run
PHP7 and Mysql
simple system for hotel room management that would update both local and online database


any tips or suggestions?
TIA


Maybe ?

https://projects.raspberrypi.org/en/pro ... -wordpress
Retired disgracefully.....
......to an uncomplicated life !

Rather than negativity think outside the box !

ankith26
Posts: 235
Joined: Mon Mar 25, 2019 11:08 am
Location: /home/pi/pythonprojects/test.py
Contact: Website

Re: Question: Pi 4 as a web server

Sat Feb 15, 2020 11:35 am

I had followed this ( https://howtoraspberrypi.com/how-to-ins ... y-pi-lamp/ ) tutorial a few months ago on my raspbian stretch OS. It had a few hiccups but in the end, it worked.
And I guess the same would also work on buster.
I sat thinking for 5 minutes on what to put here. Finally I put something like this.
Check out my github page @ https://github.com/ankith26

ankith26
Posts: 235
Joined: Mon Mar 25, 2019 11:08 am
Location: /home/pi/pythonprojects/test.py
Contact: Website

Re: Question: Pi 4 as a web server

Sat Feb 15, 2020 11:39 am

fruitoftheloom wrote:
Sat Feb 15, 2020 11:32 am
itkenb wrote:
Sat Feb 15, 2020 10:54 am
Thinking to buy a pi 4 and use it as a web server

I want to run
PHP7 and Mysql
simple system for hotel room management that would update both local and online database


any tips or suggestions?
TIA
Maybe ?

https://projects.raspberrypi.org/en/pro ... -wordpress
That solution looks better as it comes from the official website of the raspberry pi.
I sat thinking for 5 minutes on what to put here. Finally I put something like this.
Check out my github page @ https://github.com/ankith26

markatlnk
Posts: 55
Joined: Sun Feb 23, 2014 7:53 pm

Re: Question: Pi 4 as a web server

Sat Feb 15, 2020 2:57 pm

I have been running a web site with email system on a pi for many years. I updated it from a pi2 to a pi4 last year. I have a static IP with 1G up and down. You are welcome to go look at it.

zjunk.net

We use it share our vacation trips in a Wordpress blog, I take a few photos and my wife writes. I turned off the comments.

The email system is more of an issue, when I updated to the pi 4, I made a bunch of changes and broke spam assassin so I do get a bunch of spam. I really need to get back to that one of these days.

I am running a 1T SSD with it and the SD-card only has the boot directory.

It has been 99 days from last reboot which is very common. I do have a fan case on it as it can get a bit toasty. It isn't even on a UPS, our power here has been very reliable. I had an up time of over 500 days at one point.

Mark

itkenb
Posts: 5
Joined: Sat Feb 15, 2020 10:07 am

Re: Question: Pi 4 as a web server

Mon Feb 17, 2020 8:24 pm

fruitoftheloom wrote:
Sat Feb 15, 2020 11:32 am
itkenb wrote:
Sat Feb 15, 2020 10:54 am
Thinking to buy a pi 4 and use it as a web server

I want to run
PHP7 and Mysql
simple system for hotel room management that would update both local and online database


any tips or suggestions?
TIA


Maybe ?

https://projects.raspberrypi.org/en/pro ... -wordpress
Thank you!

Is it safe to run 24/7/365 on SD card? I have read topics regarding worn out sd cards

itkenb
Posts: 5
Joined: Sat Feb 15, 2020 10:07 am

Re: Question: Pi 4 as a web server

Mon Feb 17, 2020 8:26 pm

markatlnk wrote:
Sat Feb 15, 2020 2:57 pm
I have been running a web site with email system on a pi for many years. I updated it from a pi2 to a pi4 last year. I have a static IP with 1G up and down. You are welcome to go look at it.

zjunk.net

We use it share our vacation trips in a Wordpress blog, I take a few photos and my wife writes. I turned off the comments.

The email system is more of an issue, when I updated to the pi 4, I made a bunch of changes and broke spam assassin so I do get a bunch of spam. I really need to get back to that one of these days.

I am running a 1T SSD with it and the SD-card only has the boot directory.

It has been 99 days from last reboot which is very common. I do have a fan case on it as it can get a bit toasty. It isn't even on a UPS, our power here has been very reliable. I had an up time of over 500 days at one point.

Mark
Thank you!

Is it safe to run 24/7/365 on SD card? I have read topics regarding worn out sd cards

Heater
Posts: 14760
Joined: Tue Jul 17, 2012 3:02 pm

Re: Question: Pi 4 as a web server

Mon Feb 17, 2020 9:08 pm

itkenb wrote:
Sat Feb 15, 2020 10:54 am
I want to run PHP7 and Mysql simple system for hotel room management that would update both local and online database
...
Is it safe to run 24/7/365 on SD card? I have read topics regarding worn out sd cards
I suggest that if you want to run your business on a computer, any kind of computer, you have to be aware that the computer or it's hard drive or SSD or any other component can fail at any time. At which point your business stops.

What to do?

Either you have to have someone to call on 24 hours per day, ready for the day things fail.

Or you have to arrange multiple redundant systems.

Perhaps SD cards are less reliable than hard drives or SSD's in this respect. Makes no difference. You have to be ready for failure no matter what.

It's up to you to decide what risks you want to take in running your business.
Memory in C++ is a leaky abstraction .

markatlnk
Posts: 55
Joined: Sun Feb 23, 2014 7:53 pm

Re: Question: Pi 4 as a web server

Tue Feb 18, 2020 12:59 am

My server only boots from the SD card, its main / directory is on the SSD. It is the same way I did it on the Pi2. The /boot directory is all that is needed there. There are ways to get it to boot from the SSD, but I never bothered. The SD card isn't written to except for updates, so it shouldn't ever have any issues.

Mark

itkenb
Posts: 5
Joined: Sat Feb 15, 2020 10:07 am

Re: Question: Pi 4 as a web server

Tue Feb 18, 2020 7:27 pm

markatlnk wrote:
Tue Feb 18, 2020 12:59 am
My server only boots from the SD card, its main / directory is on the SSD. It is the same way I did it on the Pi2. The /boot directory is all that is needed there. There are ways to get it to boot from the SSD, but I never bothered. The SD card isn't written to except for updates, so it shouldn't ever have any issues.

Mark
Well I guess I'll go with sd cards.. I'm will have once a month maintenance and the hoter/resort is not that popular.. so... I think it will not stress out the SD in terms of writing to database.... THANKS!

itkenb
Posts: 5
Joined: Sat Feb 15, 2020 10:07 am

Re: Question: Pi 4 as a web server

Tue Feb 18, 2020 7:30 pm

Heater wrote:
Mon Feb 17, 2020 9:08 pm
itkenb wrote:
Sat Feb 15, 2020 10:54 am
I want to run PHP7 and Mysql simple system for hotel room management that would update both local and online database
...
Is it safe to run 24/7/365 on SD card? I have read topics regarding worn out sd cards
I suggest that if you want to run your business on a computer, any kind of computer, you have to be aware that the computer or it's hard drive or SSD or any other component can fail at any time. At which point your business stops.

What to do?

Either you have to have someone to call on 24 hours per day, ready for the day things fail.

Or you have to arrange multiple redundant systems.

Perhaps SD cards are less reliable than hard drives or SSD's in this respect. Makes no difference. You have to be ready for failure no matter what.

It's up to you to decide what risks you want to take in running your business.
Thanks man!... Well... All it does is write on database... so SD should be fine for at least a year...

peppe8o
Posts: 11
Joined: Sun Apr 07, 2019 9:57 am
Contact: Website Twitter

Re: Question: Pi 4 as a web server

Fri Feb 21, 2020 6:59 pm

Even if you have anyway to install a LAMP server (I suggest MariaDB instead of MySQL), you could also try Qloapps (open source). Once LAMP server is installed, you need to setup dependencies and upload installation package to Apache home directory.

It worked for me on a Raspberry PI 3 B+, so a PI 4 should work fine: https://peppe8o.com/2020/01/open-source ... d-qloapps/

Regarding data backup, you usually have 2 options:
  • Periodically bakup application files: you must now what files to backup (usually database data and apache data) and how to restore them. Phpmyadmin could help for database data
  • Periodically backup entire SD card: this is the simpler way, but requires planned stops to your server in order to extract SD card and create its image

Return to “General discussion”