hashbang / shell-server

#! shell server base images, ready to boot and allow user logins.
https://hashbang.sh
MIT License
106 stars 33 forks source link

[QUESTION] how do I `~/Public` page #142

Open Veraellyunjie opened 3 weeks ago

Veraellyunjie commented 3 weeks ago

How do I set up a simplest "Hello, world!" webpage?

I haven't found it in man hashbang, on the website and in the repo.


cat .config/systemd/user/SimpleHTTPServer@.service`
...
#each user needs to change the port to an unused value above 1024
ExecStart=/usr/bin/python3 -m http.server %I
...

No idea, TBH.

How do I find out which ports are unused? (the internet suggest a couple of commands, all sudo. I may not sudo, may I?)

WTF is that %I? Now, thanks to https://github.com/hashbang/shell-server/issues/105#issuecomment-545555557 and ExecStart=/usr/bin/sh -c 'echo "%I" > wtf_I; /usr/bin/python3 -m http.server %I' and cat Public/wtf_I I know it is an argument substitution, and one runs systemctl --user start SimpleHTTPServer@UNUSED_PORT_ABOVE_1024


What is the address of the page:

A port to each user. Does it mean the page's address becomes:

Is there no way to get rid of port in address?

Again, what is the final address of the page?


I tried:

mkdir Public
echo '<html><body>Hello, world!</body></html>' > Public/index.html
systemctl --user daemon-reload
systemctl --user restart SimpleHTTPServer@...

I have tried several port numbers for SimpleHTTPServer@ and all abovementioned addresses. The page doesn't open


Similarly, what are the steps for nginx in place of http.server?


Please: