A web server (Apache, nginx) on the Librem 5?

Hello!

I backed the Librem 5 (and can’t wait :smiley:), and therefore am searching for alternatives to the softwares I currently use on my Android phone.

An app that I use is Clue: it’s a period tracker (it does a bazillion other things but I use it only as a period tracker & reminder). I did not find any usable alternatives on GNU/Linux (especially usable on a small screen). So I thought I might develop one. But I’m a web developer: my languages are HTML/CSS, JS & PHP; I’ll need a web server - Apache, nginx, another one? - to run on the Librem 5. And I wonder: is this phone powerful enough for that? (and is it wise?)

Thanks in advance.

2 Likes

Since we can run nginx (and several web services) on this kind of ARM server without any problem, I think it should work on the L5.

On my Linux smartphone BQ E4.5 with UBports I use as web server python3 -m http.server 8000 to present prefetched OSM tiles.

2 Likes

hi there! :slight_smile:

id like 2 suggest u 2 check this out, even if its using lua for backend, its a really simple and powerful language, even more after knowing js.
btw caution: once u learn it ull fall in love (mayb even before that :smiley: )

have fun! :slight_smile:

@Torrone Thanks for the confirmation :slight_smile:

@guru Interesting, but is this server PHP-ready? I don’t know Python…

@hippi Interesting also, but I’m not sure I have time (and motivation) to learn a new language just for a small application that I need. But who knows? As you say I could fall in love :stuck_out_tongue:

1 Like

I have no knowledge about writing some CGI-BIN in PHP. If you send me a 10-liner off-thread, I could test it.

@Lamecarlate, assuming someone puts the necessary packages in the (ARM64) repo, there’s nothing that should hold you back to do that. I assume you’re also familiar with MySQL/MariaDB, from the classical LAMPP stack, or did you intend to write the app state to a file via JS?

I think the real question is, do you really want to have a full webserver and possibly a database running all the time? The phone is certainly capable of that, but I guess it will occupy several 100 megs of RAM. OTOH, every tab in a browser does that, too, nowadays, so… :man_shrugging:

Depending on how regularly you do that, you might also spend some time setting those servers up properly, so you might as well consider learning a new language :wink:

Personally, I’d suggest to have a look at QtQuick, which Plasma and Plasma Mobile are based on. It will feel very natural to you, probably. You might soon wonder why writing web pages is so much more complicated than QtQuick. :wink:
The good thing is that you can re-use all your JS knowledge and that QML is really easy if you know HTML. Here’s two examples: Calc, Clock. It seems you can even directly access local files, but I never tried.

3 Likes

You’re right: I don’t think I want that. The fact is that right now it’s the only thing I can do.

Well, Qt has attracting me for some times, but I did not take the time to really dive in - it’s difficult to make the decision of learning an entire new language. But I’ll give a go to Qt and Lua, let’s try something new!

2 Likes

nice to hear that :smiley:

https://www.lua.org/pil/
this is where i started it after a long research for the perfect tool for all my plans (so many!)

http://www.lua.org/manual/5.1/manual.html#7
here u can follow up the changes, cuz the (free version of that) book is for 5.0, but turbo relies on luajit, that is 5.1 compatible
skip the 3rd and 4th paragraphs here, as using the c api is suboptimal for luajit (the ffi is preferred for more horsepower) and u also wont need it (nor the ffi for now). its enough to just skim the 5th paragraph the 1st time to know ur possibilities, and consult with those parts of the manual in case of need.

some places to visit and look around:
http://www.lua.org/start.html
http://lua-users.org/wiki/LuaDirectory
http://lua-users.org/wiki/LibrariesAndBindings
http://luajit.org/luajit.html

lua is a minimalist language, cuz its basically limited to c99 standards, so u will probably need some extra goodies, but u can find really anything u could need, however a lotsa lua programmers prefer to write their own tools, cuz lua is very flexible and easy to use, so the users often adopt their style :smiley: currently i only use luafilesystem and tekui (gui toolkit) turbo will be the next that i will pick up, but by the years of using lua i really done my research (i just checked out every alternatives!), im also watching the development of turbo, but actually i only tried it and read some of the sources and docs, but its really neat based on my current knowledge. :slight_smile:

on the other hand, the lua mailing list is a very friendly place, and i also will to help u if u would like it, so just ping me in case of need, im a true lua fanboy, even after ive seen so much hardcore stuffs around and i can read generally whatever i find and it was written for a computer, so all the possible temptation was given to find anything better (but YMMV) and i actually make much research all around and very often :smiley:

so just have fun, i hope and believe that ull enjoy it! :slight_smile:

1 Like

im not editing the previous message just to be sure ull find this, but the 1st link is not that straightforward as ive thought so, but here u go, if u havent find it:

https://www.lua.org/pil/contents.html
pt. 1 and 2 are the important stuffs; 3 can be used at will; 4 can be skipped for now, however lua-users have other resources for learning lua, some can be even faster, but pil isnt that long actually and kinda fine… btw for an environment, u can try zerobrane studio (not “brain”, but brane is a mathematical stuff :smiley: ) ive tried it, its nice, but im building my own, cuz i wanna bring all my wishes on the same fund for interoperability and hackability for everything like web (libcurl, luakit, turbo, mayb wireshark, cuz thats also using lua :smiley: ) graphics, whatever around the system and whatever filetypes, with live coding (i wanna bring coding down to the level of mortals, so i needed a freestanding small fast and flexible gui for start with) and a lot more based on these, and the tools that ive built by the time, but this is a very long story in details and still in incubator stage… previously i gave up python cuz various reasons it was totally not suitable, so im really careful about possibilities and planning, cuz these will be wired all together in an ecosystem. btw dont think about it as a bloaty mess, cuz only the necessary parts running, and its about interoperability :smiley:

Hello everybody, I am thinking to purchase the Librem 5 USA. I already send my concerns to the staff email, but I think it will take a while due to the news of shipments. I thought that maybe someone here as a Librem 5 or Librem 5 USA user/owner, might share some insight about the phone’s capability as a Apache HTTP server, that is, Debian’s version of a Apache HTTP Server.

In addition, Apache requires the essential services for its operation to connect to the world wide web. I would like to know at the very least, if the phone, phone modem, or Purism’s mobile data network, supports an router/modem/ssh interface to forward ports? The firewall might receive configurations similar to that nature. I would also like to know if the phone, phone modem, or Purism’s mobile data network will support private/public IPv4 ip addresses.

The last thing I don’t want is a quite/fairly expensive investment with recurring costs to boot. Yes, Librem 5 and Librem 5 USA is the phone with a free GNU/Linux OS platform. Unlimited phone calls and text messages are great too. However, some services may require the network host levels to permit such user privileges.

Whoops, this topic has stagnated since three years? Maybe there are 
signs of progress?

Sincerely,
Ribby

I’m thinking of running Docker on mine when I get it, then I can play around with any ARM capable containers on it, so you could spin up an ngnix container, and any other thing that’s available on dockerhub.

The obvious question is: for how many users? There is a big difference between

I just want to deploy some pages for my own personal use (in which case you might not even need to worry about e.g. public IP address)

and

My pages will be being used by thousands of users all around the world with X page requests per second.

That’s a good question. I think you will need to ask Purism.

There are really two questions … static IP address? and public IP address?

Since you ask the question at all, I assume that you are in the US (because the question will surely depend on the country and carrier).

My pages will probably be personal, but not personal enough to be labeled as private view. I say some of my pages will cover certain topics of interests, appealing to those seeking those interests for whatever the reason. Some topics are meant for leisure, while other topics cover more serious depth such as the news, both in internet activities and real life. Just in case my website does develop into something populous, I rather be ready for the users beforehand. I am sure that with a phone running a free GNU/Linux operation system, plus internet service by the very company behind the OS, the phone and service capabilities suffice and even surpass expectations. That means I am preparing to compensate for the cost of unlimited data. Why am I that confident? Well, just to let you know, I happened to succeed in creating a website for public viewing. IPv4, IPv6, and a purchased/registered domain name, are synced together to read my specified website directory. Yes, it is on the Debian’s Apache build (on PureOS desktop), the one with compartmental config files and such. Yes, there is also httpd.conf, I happened to get the Windows version running in public view before. Forgotten about httpd.conf now due to lack of interest in documentation and I didn’t see that I will be getting a domain name years before. You can tell me with a healthy amounts of skepticism, cynicism, and/or pessimism, that I have taken things for granted. Still, I believe I am on a roll, regardless of duration expectations. If someone were to ask how to host a website on a desktop machine in the current standards/basics, I am afraid it will have to be on another topic. This topic is reserved for the Librem 5 (USA version included) smartphone.

I say to have the modem to accommodate as much ip address types as possible. It is best to have compatibility to fall back to a stable scale. That is considered a contingency plan. Typically, static IP address is static enough to keep the website running on the same information. Even if the hosting devices were to shut down for a while, its reactivation will set back to the same value. There’s less maintenance in configurations with static IP address mode. Public IP address is needed for public access. I did tried dynamic IP address before. There’s a bit of update for configurations, but it shouldn’t be too much of a problem.

My mention of Librem 5 USA is a good indication in assuming so. I suppose there’s a different standard set for each region in how they deal with internet networking. Maybe a bit off topic. Any real difference between original Librem 5 and Librem 5 USA? Is it a different/regional (encoded) standard of communication protocols?

Nope. The difference between Librem 5 and Librem 5 USA is only in the manufacturing and components - well also in the ordering lead time. The software is the same, the internet networking is the same - and both devices will work in the USA and both devices will work outside the USA.

(Even the WiFi is the same. There are theoretically differences between the exact details of WiFi bands in different countries but a) most people don’t care and b) if you do care, you cover that by configuration.)

Any difference in mobile phone networks is covered by the three different modem variants (A1, E1 and T1) but even then I don’t think there is much difference apart from the exact set of LTE bands that are available. So whether you have a Librem 5 or a Librem 5 USA, for use in the USA you would want the A1 modem variant - and whether you have a Librem 5 or a Librem 5 USA, for use in Europe you would usually want the E1 modem variant.

Well I do urge you to ask Purism because I know that here (not in the USA) it can be quite difficult to get a mobile phone with a public static IP. Carriers don’t typically support it for mainstream (consumer) services. Instead, all phones are behind Carrier Grade NAT (CGNAT) and so it is doubtful that running a web server for public use is viable at all. I would need a premium (business) service in order to get a public static IP and that would then be a data-only service i.e. no voice calling but of course that will work fine for any VoIP application if VoIP is adequate for the voice side of things.

The only way to know is to ask.

I expect that only the carrier is the obstacle here. The phone itself would support any type of IP address allocation / acquisition that a standard Linux computer supports (and for both IPv4 and IPv6).

That was one of the longest answers on the question “What load do you expect on your web server” without actually answering the question. It is one thing if 100 people distributed across the day are going to access some HTML pages and another thing if 10000 people are going to simultaneously access video streaming. Your answer does not help people answering the question if the specs of Librem 5 are sufficient (sufficient for what?).

Librem 5 can be a web server just as any other general purpose Linux computer.
Will running a web server on the L5 discharge the battery even faster? Yes, it will. So you might end up with a phone that needs to be charged every hour or something.

What advantage do you expect from hosting a website on Librem 5 compared to other solutions like hosting in the cloud or hosting on a raspberry pi at home?
Maybe you expect an advantage that is simply non-existent and just a waste of your battery time.
The statement “I rather be ready for the users beforehand” sounds like a textbook use case for a cloud hosting where you can start small and scale according to the need. So it is indeed important to know what is the problem that you try to avoid by avoiding cloud hosting.

Regarding the static IP, you can set up a domain name that routes to your L5 web server even if your IP is not static using something like ddclient. But again this all depends on what goals you are trying to achieve.

I doubt that we can help you in the forum if you don’t explain “What is the problem that you want to solve?”.

Like for example:
"Hi, I want to run an onion website for selling rare poisonous frogs. I expect between 10 and 50 visitors per day that would browse a collection of hi res images of poisonous frogs (100 images a 5 MB) in order to choose the one they like. Twice an year there is an international convention of the reptile enthusiasts and in the days during and immediately after the convention, I expect up to 50000 visitors per day for around a week.
I don’t want to host the website at home because…
I don’t want to host the website in the cloud because…
"

Picking up on that point, I expect that most Librem 5 power saving options would have to be disabled in order to be a plausible web server to the internet. So discharge is faster over and above whatever load the running web server imposes.

You wouldn’t have to worry about static IP if you signed up with a dynamic DNS service like noip.com

Provided that you can tolerate outages - depending on the TTL - and you can tolerate that clients may temporarily be going to the wrong server and hence that your web site could in theory be spoofed.

So generally you need a low TTL and ideally you would offer content only over TLS.

If you set the TTL to 0 (the only way for this to be 100% reliable and even then not) then that is not user-friendly for clients and in any case it may get overridden by intervening network infrastructure.

I am glad that someone returns feedback about Librem 5’s potential as a web server. Running a web server on the L5 might discharge the battery, but I am sure that there are energy efficient options. Maybe plugging in a portable battery charger will resolve this potential issue.

The advantage I expect from hosting a website on Librem 5 would be a personal server that is portable (it’s pretty expensive, but on the go is on the go), able to be locked in a safe (assuming that it would have its wifi/radio frequency transmission uninterrupted while in safe), and the phone is running PureOS, a free GNU/Linux.

The problem I’m trying to solve.
I want to run a website (I got SSL/TLS/HTTPS certification down) that usually hosts my software/modules project. They may come in the form of programs, modifications, case studies, media, and so on. I may host pages about technology news and how it relates to my software/modules project interests. I may also host pages about news in general and possibly other points of interests outside computing and technology. I expect about 10 to 100 visitors throughout the week. Rarely is the case for 100 visitors per day. These visitors will usually visit my website to see updates of projects and project-related servers. They might visit to access case studies and media regardless the projects. Perhaps the news and other points of interests might assist them incorporate the case studies to their own studies.

I don’t want to host the website at home because I have concerns about possible interference with the server or any of its supporting services. Yes, web server security does improve on the electronic front, but the maintenance of the machines is just as important. Server mis-management, regardless of my presence, is something I don’t want to deal with. I don’t want to be the one having to sort through policies where I am not at fault.
I don’t want to host the website in the cloud because it might have legal terms that may interfere with my project development. I also read that cloud computing might have privacy issues (raspberry pi included in some instances). Maybe people don’t mind, but I am trying to stick to the free GNU/Linux alternative. I cannot have proprietary software/services to interfere in case of a unexpected host machine failure (it does happen, I got it several times before). Plus, the host is on cloud computing. It may go down at times due to the multitude of user inputs and outputs.

~~
I was about to go dive into the purchase to see for myself, but I thought about something beforehand. The thought seems to be a pretty good idea.

If someone wants to try out the desktop version of debian apache server installation and setup, I can pass on my findings upon request. I even have some findings regarding smartphone specific configurations. The distribution will have to be revised and publicated on restricted attachment form. It is a specific OS case study.

I don’t want to insult anybody, I have to check for the creditability of the phone’s operation. Does the Librem 5 actually have operable wifi capability? Same goes for its modem and whatever that wifi networking service be? Most free GNU/Linux have limited options in terms of wifi connectivity. I am sure that both the Librem 5 and network are in proper working order. I just never tested wifi connection on a free GNU/Linux before, much less on Linux managing calls and text messages.
~~