TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Sherver: Bash lightweight web server

163 点作者 turrini超过 3 年前

18 条评论

_wldu超过 3 年前
Here&#x27;s my small webserver:<p><pre><code> #!&#x2F;bin&#x2F;bash while : ; do cat conference.txt | nc -l 80; done </code></pre> Here&#x27;s the story behind it:<p><a href="https:&#x2F;&#x2F;www.go350.com&#x2F;posts&#x2F;finding-a-hacked-server&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.go350.com&#x2F;posts&#x2F;finding-a-hacked-server&#x2F;</a>
评论 #29649107 未加载
评论 #29651290 未加载
评论 #29650784 未加载
评论 #29649125 未加载
评论 #29653094 未加载
BossingAround超过 3 年前
&gt; I didn&#x27;t want to install and configure Apache or nGinx. In fact, I didn&#x27;t want any configuration.<p>Personally, in that case, I&#x27;d use:<p><i>python3 -m http.server</i>
评论 #29649155 未加载
评论 #29648899 未加载
评论 #29653537 未加载
throwaway984393超过 3 年前
They reinvented CGI scripts but didn&#x27;t actually implement CGI. Could have implicitly supported a lot of apps by default. There&#x27;s some pretty decent CGI libraries for Bash, too.<p>Personally I use busybox&#x27;s httpd (which does support CGI) for a small portable web server.
zoomablemind超过 3 年前
Just an idea, along the lines of a single binary webserver: one may use Fossil SCM [1] to easily spawn a webserver (&#x27;fossil server&#x27;, or even &#x27;fossil ui&#x27;), no need for root (port 8080 by default).<p>The pages could be served as part of a project (all version-controlled), or as documentation pages, or as wiki. Styling is somewhat limited, but could still be done creatively.<p>Additionally, a static website or even a whole application (PHP or the likes) could be rolled out via &#x2F;ext, the &#x27;extension&#x27; path.<p>[1]: <a href="https:&#x2F;&#x2F;www.fossil-scm.org" rel="nofollow">https:&#x2F;&#x2F;www.fossil-scm.org</a>
medv超过 3 年前
It is a socat server, not bash. Basically a bash script calling socat.<p>Definitely not “pure”.
评论 #29648326 未加载
评论 #29649450 未加载
评论 #29648583 未加载
评论 #29653501 未加载
评论 #29653291 未加载
评论 #29653106 未加载
rascul超过 3 年前
This seems like an odd usage of cat and command substitution to me:<p><pre><code> HEAD_TEMPLATE=$(cat &lt;&lt;EOF &lt;title&gt;Sherver example&lt;&#x2F;title&gt; &lt;meta name=&quot;description&quot; content=&quot;Sherver example&quot;&gt; EOF ) </code></pre> <a href="https:&#x2F;&#x2F;github.com&#x2F;remileduc&#x2F;sherver&#x2F;blob&#x2F;master&#x2F;scripts&#x2F;index.sh#L21" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;remileduc&#x2F;sherver&#x2F;blob&#x2F;master&#x2F;scripts&#x2F;ind...</a>
评论 #29648768 未加载
评论 #29648570 未加载
IceWreck超过 3 年前
If this is pure bash then so is<p>``` caddy file-server --browse --listen :80 ```
remote超过 3 年前
Kudos for scripting a great hack in BASH.<p>Since the title reads &quot;pure bash&quot; however I was expecting to see an implementation using builtin bash features such as &#x2F;dev&#x2F;tcp.<p>Have you considered solving this problem using BASH builtin support for TCP?
评论 #29648499 未加载
MisterTea超过 3 年前
Plan 9&#x27;s rc-httpd is quite useful, supports cgi and serves many plan 9 web sites, many of which run werc <a href="http:&#x2F;&#x2F;werc.cat-v.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;werc.cat-v.org&#x2F;</a><p>It can also run on Unix via plan 9 port (p9p) or derivatives.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;9front&#x2F;9front-test&#x2F;blob&#x2F;master&#x2F;rc&#x2F;bin&#x2F;rc-httpd&#x2F;rc-httpd" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;9front&#x2F;9front-test&#x2F;blob&#x2F;master&#x2F;rc&#x2F;bin&#x2F;rc-...</a>
Brian_K_White超过 3 年前
Ah, no. Bold claim unrealized. Immediately I see many unnecessary forks and externals to do things that bash actually can do itself.
montroser超过 3 年前
For the occasional service where you are essentially just wrapping an existing binary, a bash server behind uwsgi can be totally sensible.
montroser超过 3 年前
Fantastic. For a more sinatra-inspired take, see also <a href="https:&#x2F;&#x2F;github.com&#x2F;guigo2k&#x2F;ganesh" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;guigo2k&#x2F;ganesh</a>
notRobot超过 3 年前
See also:<p>darkttpd: When you need a web server in a hurry.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;emikulic&#x2F;darkhttpd" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;emikulic&#x2F;darkhttpd</a>
laumars超过 3 年前
&gt; I didn&#x27;t want to install and configure Apache or nGinx. In fact, I didn&#x27;t want any configuration.<p>If you ignore all of the manual installation instructions and any dev time you took to create this, then sure.<p>I’m not going to argue that the author should have used something else instead though. It’s a personal project used purely on an internet system of his house. For those kinds it projects “because I could” is as good a reason as any. I just think more authors should be honest and say “I just did it because it seemed fun at the time”
评论 #29651576 未加载
adamddev1超过 3 年前
Very cool. Was hoping to see Sean Connery in the README.
pkrumins超过 3 年前
Also `php -S` is very handy.
vkazanov超过 3 年前
One those things that is s scarily beautiful
moondev超过 3 年前
go run github.com&#x2F;patrickhener&#x2F;goshs@latest