Simple web server linux

Самый простейший и легковесный http-сервер?

Какой простейший и самый легковесный HTTP сервер вы можете посоветовать? Чтобы никаких лишних примочек, никакой поддержки интерпретаторов. Чтобы умел только показывать файлы и содержимое директории и занимал минимум памяти. Хочется воткнуть такой на Raspberry Pi.

Даже без нагрузки требует в 4 раза больше памяти чем nginx.

Старенький apache-ик без модулей?

В чём преимущество старенького apache перед новеньким nginx?

На правах вопроса, а lighthttpd чем не light?

raspberry вполне себе и полновесный апач потянет

lighttpd всегда ставлю. Даже на 256 метрах WD MBL хорошо себя вел.

nginx и postfix (для пересылки на гуглоящик) на заNATном сервере за 3 бакса в год. Крутит мои статичные сайтцы. Потребляет 8МБ памяти.

Сами пробовали что советуете?

Only Supports: gif jpg jpeg png ico zip gz tar htm html json

Спасибо! Думаю, ничего легковеснее просто не бывает. Разве что кто-нибудь сподобится написать его на ассемблере.
На всякий случай, вот его запускалка для systemd. Вдруг кому понадобится.

1. Это не легковесный сервер.

2. Он не для продакшена даже, если ваш сайт это одна страничка посвящённая вашему котику.

3. На 80 порт повесите от рута что ли?

А что это за сервер такой?

Там на сайте чёрт ногу сломит.

Вот их подсайт с натами i-83.net. (128МБ закончились.)

https://gist.github.com/alexey-sveshnikov/3a109b61ce6241770a86

:;while [ $? -eq 0 ];do nc -vlp 8080 -c'(r=read;e=echo;$r a b c;z=$r;while [ $ <#z>-gt 2 ];do $r z;done;f=`$e $b|sed ‘s/[^a-z0-9_.-]//gi’`;h=«HTTP/1.0»;o=«$h 200 OK\r\n»;c=«Content»;if [ -z «$f» ];then ($e $o;(for n in *;do if [ -f «$n» ]; then $e «`ls -gh \»$n\«`
»;fi;done););elif [ -f «$f» ];then $e «$o$c-Type: `file -ib \»$f\«`\n$c-Length: `stat -c%s \»$f\«`»;$e;$e $f>&2;cat «$f»;else $e -e «$h 404 Not Found\n\n404\n»;fi)’;done

Уриэль в гробу переворачивается.

А почему бы и нет? У меня на Raspberry Pi арч, у него встроенный systemd, почему я не могу использовать его встроенные функции для запуска? Не bash скриптом же его запускать вручную.

Он очень даже лёгкий. На всяких мелких впс за пару баксов в год с 64-128 памяти lighttpd вполне неплохо себя чувствует.

Источник

Локальный веб-сервер под Linux, с автоматическим поднятием хостов и переключением версий PHP

Скорее всего какие-то части этой статьи уже знакомы многим хаброжителям, но в связи с покупкой нового рабочего ноутбука я решил собрать все крупинки воедино и организовать удобное средство для разработки. Мне часто приходится работать со множеством маленьких проектов, с разными версиями PHP, часто переводить старые проекты на новые версии. В далёком прошлом, когда я был пользователем Windows то использовал OpenServer. Но с переходом на Linux мне нехватало той простоты создания хостов и переключений версий которые были в нём. Поэтому пришлось сделать еще более удобное решение на Linux =)

будет запущен тот же файл но уже с версией PHP 7.2.7

Другие версии доставляются аналогичным описанным ниже способом.

Для создания еще одного сайта просто создаем в /var/www/ папку имеющую окончание .loc, внутри которой должна быть папка public_html являющаяся корнем сайта

Вот собственно и все. Как без дополнительных мучений, перезапусков, и редактирований конфигов имеем автоматическую систему для работы с сайтами.

Читайте также:  Как скопировать файл до загрузки windows

Всё это я проверну на LinuxMint19, он на базе Ubuntu18.04, так что с ним все будет аналогично.

Для начала поставим необходимые пакеты

Postfix ставим в качестве плюшки, как простое решение(в мастере установки, всё по умолчанию выбираем) для отправки почты с локальной машины.

Так как это локальная разработка и я единственный пользователь. То мне удобней перенести папку с проектами в мою домашнюю дерикторию. Она у меня маунтится отдельным диском и мигрирует при переустановке системы. Самый простой способ это создать ссылку, тогда не нужно менять пути в настройках да и путь привычный для всех.

Скопируем папку созданную апачем в домашний каталог, создадим на ее месте ссылку, не забыв поменять пользователя на себя и обменяться группами с апачем.

Создадим папку в которой будем собирать исходники PHP для разных версий

Также нам понадобится папки для CGI скриптов

И runtime папка для этих же скриптов, с правами

И так как каталог у нас находится в оперативной памяти, добавим его создание при старте системы, для этого добавим в /etc/tmpfiles.d/fcgid.conf

У меня dnsmasq-base идет с коробки, если нет то его всегда можно доставить.

Добавим правило в его конфигурацию. Найти файл конфигурации dnsmasq.conf можно так

Либо если он как и у меня является частью NetworkManager то создать новый файл конфигурации в /etc/NetworkManager/dnsmasq.d/local.conf
Добавим в него строчку для перенаправление нашего локального домена на локальную машину.

Также нужно включить необходимые модули апача

Предварительная подготовка завершена, приступаем к сборке различных локальных версий PHP. Для каждой версии PHP проделываем следующие 4 шага. На примере 5.6.36

1. Скачиваем исходники нужной версии и распаковываем их

2. Cобираем из исходников нужную версию PHP, и помещаем ее в /opt/php-5.6.36

3. Создаем CGI для обработки этой версии в /var/www/cgi-bin/php-5.6.36.fcgi

4. Делаем файл исполняемым

5. Добавляем экшен для обработки каждой версии в /etc/apache2/mods-available/fcgid.conf

6. Добавляем правило для обработки каждой версии в /etc/apache2/sites-available/000-default.conf

Ну вот и всё. Осталось только перезапустить apache и dnsmasq и пользоваться

Источник

Simple web server linux

A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Asio (both Boost.Asio and standalone Asio can be used). Created to be an easy way to make REST resources available from C++ applications.

See https://gitlab.com/eidheim/Simple-WebSocket-Server for an easy way to make WebSocket/WebSocket Secure endpoints in C++. Also, feel free to check out the new C++ IDE supporting C++11/14/17: https://gitlab.com/cppit/jucipp.

  • Asynchronous request handling
  • Thread pool if needed
  • Platform independent
  • HTTPS support
  • HTTP persistent connection (for HTTP/1.1)
  • Client supports chunked transfer encoding
  • Timeouts, if any of Server::timeout_request and Server::timeout_content are >0 (default: Server::timeout_request=5 seconds, and Server::timeout_content=300 seconds)
  • Simple way to add REST resources using regex for path, and anonymous functions

See http_examples.cpp or https_examples.cpp for example usage.

See particularly the JSON-POST (using Boost.PropertyTree) and the GET /match/[number] examples, which are most relevant.

  • Boost.Asio or standalone Asio
  • Boost is required to compile the examples
  • For HTTPS: OpenSSL libraries

Compile and run

Compile with a C++11 compliant compiler:

Run the server and client examples: ./build/http_examples

Direct your favorite browser to for instance http://localhost:8080/

Before running the server, an RSA private key (server.key) and an SSL certificate (server.crt) must be created. Follow, for instance, the instructions given here (for a self-signed certificate): http://www.akadia.com/services/ssh_test_certificate.html

Run the server and client examples: ./build/https_examples

Читайте также:  Как посмотреть состояние raid windows

Источник

6 lightweight Web Server for Linux

Updated — October 7, 2019 by Arnab Satapathi

Here’s how you can create a lightweight web server on Linux easily to test some code, serve static HTML files or whatever you like.

There’s no need of a full blown web server like Apache or NGINX, just few lines of basic command will be fine to do this job. Lets do it in 5 different ways !

Instant python web server

Python is pre-installed in almost every UNIX or GNU/Linux distributions, packs many feature reach modules inside it. Python commands could be used as an web server very easily.

For r python 2.7.x versions use this command.

Replace the port_number with port number of your choice.

To start a python web server on port 8080, by default it binds port 8000 with all available network interfaces.

Note: Binding any port number bellow 1024 requires root privilege, in such case use sudo before the command . If there is a index.html file at that directory, it will be served by default, else contents of that directory will be served.

For python 3.x version use this command.

test: Open up your favorite web browser, type 127.0.01:8000 in the URL bar and hit enter .

Busybox httpd web server

Busybox, The Swiss Army knife of Embedded Linux, packs many stripped-down UNIX tools inside a single static executable binary. It runs on most UNIX/Linux systems and pre installed in all Debian based distributions.

Busybox have an awesome feature rich HTTP server applet, busybox httpd , very simple and lightweight but also configurable enough. Download latest busybox and read more about here.

note: by default busybox httpd binds port 80 with all available network interfaces and reads /etc/httpd.conf configuration file .

Node.js simple web server

If you’re already familiar with NodeJs or love to fiddle with javascript, the easiest way to server static files is to use the http-server node module.

Just install the module globally, and start the server just by typing the command http-server .

Obviously you need super user privileges to install node modules globally. By default the hhe server binds to port 8080, to bind a port below 1024, you also need superuser privilege.

Read more about the http-server here.

Webfsd lightweight web server

Webfs or webfsd is a very lightweight, linux simple web server for static pages and files. It is highly configurable, configurations are stored at the /etc/webfsd.conf file, which could be very easily edited.

note: By default webfsd binds port 8000 with all available network interfaces with /var/www/html as document root directory in Debian.

Netcat as a linux simple web server

Netcat or nc , the swiss army knife for TCP/IP , is a very popular network troubleshooting tool.

It could be used as port scanner, port listener, file transfer agent, network connected file backup tool, as a backdoor even as a vary lightweight web server, amazing !

Netcat based web server is mainly used for serving text only files over HTTP, useful in monitoring purpose. Assuming you have basic shell scripting knowledge, lets start a simple HTTP server with netcat. Save the script bellow with whatever name you want , modify it according to your needs, make it executable with chmod +x and run it .

Читайте также:  Inkscape mac os тормозит

You may want to change the line cat /var/www/index.html with whatever you want to do, like /sbin/ifconfig eth0 etc. etc. If the sleep 1 line is removed, it will be difficult to stop the script with CTRL+C .

PHP inbuilt lightweight web server

If you have installed php 5.4 or above, then you could easily use the php CLI to create a simple and lightweight web server with.

It also have the capability of serving simple php based dynamic pages. simply use the command bellow .

If there is a index.html or index.php file , it will be server by this simple php server , now test it with your favorite web browser.

Conclusion

If you need to create a simple HTTP server with IPv6 capability in python, it’s here, python IPv6 web server.

I think now your problem is solved, if you need any further assistance just drop a comment, we’d be happy to assist you. Feel free to share this tutorial with your friends.

Hello there. Thank you very much for the information. Im trying to find out whether i really need a web server. I go through the same process all the time. why do i need one? what advantages? Im not ready to setup a web site on my system so im still trying to figure out whether i need one.
Back to the reason for this comment. I really liked the idea of using python as a web server, since it serves me up the contents of the directory i chose. I can use this strategy to set up a web site for pictures and all. Only one thing! How do i remotely get access to the web page described in your «python» method?? i tried to get on via my windows computer. went locally and remotely using both types of ip addresses and no luck. Im sure i need to add some port forwarding, but i am just checking in with you to see if this was the purpose of using the light weight web servers. Please get back to me at patrickprucha@yahoo.com. Many thanks

I use those servers to serve files on a local network, or rarely, to run a live demo of web development projects.

Sent you a mail.

January 17, 2016

The menu About — Contact us answer that you are not reachable telling that I must use another way to contact you. Then I used this concerned form.

Big challenge — Personal Cozy cloud on OpenWRT

by considering the fact that OpenWRT must not be compile with needed packages could you please consider and make a tutorial of how do install Cozy cloud on OpenWRT ?

You must know it needs node.js but it is better to use Light Cozy that allow to just add what it is needed :
Light Cozy : https://cozy-labs.github.io/cozy-light/
Full cozy : https://cozy.io/en/

Have a nice day,

January 17, 2016

Good to see you again, a long time. What a coincidence, I’m thinking about writing a tutorial about running Node.js on OpenWrt Routers. Surely I’ll write how to setup Light Cozy on OpenWrt as soon as possible. Node.js packages are currently not available on OpenWrt repo so we’ll have to build it.

Doing such experiments in constrained environment is damn tough, laptop with 40GB HDD!(after 1TB crashed) and 1.5GB monthly download+upload bandwidth quota, seriously !

Источник

Оцените статью